Javascript firefox issue
<p>I developed a .htm document with an in-built script for javascript to run a program. In google chrome, the program works fine, but I got a beta test complaint that it didn't work on firefox 14.01 or opera. On testing with firefox 14.01, I can confirm it doesn't work (I assumed opera to be the same). I cannot insist the audience upgrade their browsers, as this is supposed to be widely compatible.</p>

<p>Doing a little tracing of the issue, I installed Firebug, which, on clicking the Javascript button to generate a coordinate the first time, it worked (clearly showing the <em>function is defined and exists</em>), but the second time, Firebug complained that:</p>

<pre><code>"ReferenceError: GenerateCoord is not defined".
</code></pre>

<p>This wouldn't be so ironic if it only did this after generating an (encrypted) coordinate (thus calling GenerateCoord that is supposedly 'undefined').</p>

<p>If one looks in the code, one can clearly see that the function GenerateCoord is clearly defined before it is called. I would say firefox has an 'onclick' issue, but then it begs the question why did it work the first time I clicked it (calling GenerateCoord via 'onclick') but not the second?</p>

<p>Reloading the file allows the button to work the first time, and the first time only. I am baffled as to how firefox can call a function one time that it then says is undefined the next. Am I missing something here?</p>

<p>Javascript and HTML code can be viewed here:</p>

<p><a href="http://pastebin.com/4qykTfEW" rel="nofollow">http://pastebin.com/4qykTfEW</a></p>

<p>-</p>

<p>How do I solve the problem, and is there an easier solution than re-writing the code to avoid onclick (that seems to work in certain circumstances but not others)?</p>
