Issues with JavaScript settimeout function
<p>I am very new to JavaScript and cannot seem to get the setTimeout command to do anything. I know this has been asked many times before, but I have spent the last two hours looking at all previous cases of it and it still isn't working for me. Here is what I have got at the moment:</p>

<pre><code>&lt;html&gt;
    &lt;script type="text/javascript"&gt;

    var i = 0;
    function aloop() {
        document.write(i);
        i++;
    }

    function afunction() {
        if (i &lt;= 12) {
            setTimeout(aloop(), 1000);
            afunction();
        }
    }

    &lt;/script&gt;

    &lt;form&gt;
    &lt;input type=submit value="Click me!" onClick="afunction()"&gt;
&lt;/html&gt;
</code></pre>

<p>Can anyone tell me what I should do to make this work?</p>
