How can I write a Function A to call Function B, and Function B call Function A without finish function A , infinite loop this?
<pre><code>&lt;script type="text/javascript"&gt;
    function B()
    {
        alert('2');
        A();
    }

    function A()
    {
        alert('1');
        B();
    }
&lt;/script&gt;

&lt;html&gt;
&lt;body onload="A();"&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Is it possible to use javascript to do that without jQuery? In my script, A can call B, but B can't call A? I don't know why B can't call A in my script. I'm not sure that is because A hasn't finished so that B can't call A right now. A>B>A>B>A>B makes an infinte loop. Can I do the above result in some way?</p>
