Hi everyone,
I know you can use setTimeOut to delay the recursive output on a function, but how do you delay the initial execution of the function. Here’s the specific
problem: I want a header to slide across the window as if it were being typed on a typewriter. That part is working! But I want to delay this effect by
3-4 seconds so it doesn’t start “typing” until after a delay.
I thought I might be able to do this by putting a setTimeOut on another function that calls the “typing” effect function. No luck. Here’s my code (it’s
quite short)
<script type=”text/JavaScript”>
window.onload=update;
function update(){
timer=setTimeOut(“update2()”, 3000);
}
var mess=”Hello there!! What do you know? It worked!!”;
var j=0;
function update2()
{
document.getElementById(“letters”).innerHTML=mess.substr(0,++j);
if(j<mess.length)
setTimeout(update2, 100);
}
Thanks in advance.
Sig