I posted quite recently about an issue with javascript in firefox, and it was denoted the problem was likely document.write() overwriting the script somehow. It was suggested I
Place your script at the bottom of the page, right before the closing </body>
tag. In other words, make the script tag the last one of document.body
. That way the DOM-tree is completely loaded before the scripting starts.
Aside from a number of issues, the real issue is the document.open
statement in the GenerateCoord
function. That clears the complete document, after which - indeed - no element is left to get by any Id. Here's a jsfiddle without it.