How can I correctly implement setTimeout? : <p>I'm trying to use <code>setTimeout</code> to perform <code>document.write</code> after a certain delay after a form is submitted. For now, the delay is a static 3000ms. However, when I try to implement it, <code>document.write</code> happens instantly. How can I implement setTimeout correctly?</p>

<p>This is for a website. Form submission happens before this block of code runs, and variables are passed from what is submitted.</p>

<pre><code>
function findInterval(){
var delay = document.forms["options"]["delay"].value;
min = Math.ceil(min);
max = Math.ceil(max);
var result = Math.floor(Math.random() * (max - min + 1)) + min;
var total = parseInt(delay) + parseInt(result);
setTimeout(document.write(total), 3000);
}

</code></pre>

<p>My understanding is that my code should wait 3 seconds, then do <code>document.write(total)</code> but that's not the case. What am I doing wrong?</p>
