JavaScript setTimeout not working with prompt box
<p>Here is my code:</p>

<pre><code>var t = setTimeout("increment();", 1000 * 3);

var st;

function increment() {
    st = 1;
}

for (i = 0; i &lt; 10; i++) {

    cnt = i;
    var no1 = Math.floor(Math.random() * 101);
    var no2 = Math.floor(Math.random() * 101);

    if ((i % 4) == 0) {
        crct_ans[i] = no1 + no2;
        quest[i] = no1 + " + " + no2;
    }
    else if ((i % 4) == 1) {
        crct_ans[i] = no1 - no2;
        quest[i] = no1 + " - " + no2;
    }
    else if ((i % 4) == 2) {
        crct_ans[i] = no1 * no2;
        quest[i] = no1 + " x " + no2;
    }
    else if ((i % 4) == 3) {
        crct_ans[i] = no1 / no2;
        quest[i] = no1 + " / " + no2;
    }

    ans[i] = prompt(quest[i], "");

    if (st == 1) break;
}​
</code></pre>

<p>I want to stop the for loop if 3 seconds pass. But this is not working. For loop runs after the 3 seconds also. How can I do this?</p>
