Why is my JavaScript function "a" not defined?
<p>When I call my JavaScript function B, the JavaScript console in Firefox said that function A is not defined, but on Chrome browser it's defined. And when I call function "A" in body segment:</p>

<pre><code>&lt;input type="button" onclick="A()" value=" ..A.. "&gt;
</code></pre>

<p>Firefox said that function B is not defined. Why? </p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;script language="javascript" type="text/javascript"&gt;
            function B() {
                alert(" hi B ");
                document.write('&lt;br&gt;&lt;br&gt;&lt;input type="button" onClick="A()" value=" ..A.."&gt;');
            };

            function A() {
                alert(" hi A");
                document.write('&lt;br&gt;&lt;br&gt;&lt;input type="button" onclick="B()" value=" ..b.."&gt;');
                if (window.WebCL == undefined) {
                    alert("Unfortunately your system does not support WebCL. ");
                    return false;
                }
            }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;input type="button" onclick="B()" value=" ..B.. "&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
