PDA

View Full Version : delay or sleep function


florida
02-19-2003, 12:29 PM
I need to put some sort of delay of 5 seconds in my function before the alert message comes up. Is there a "sleep" command or something in Javascript I can use to delay 5 seconds before I do something (in this case..wait 5 seconds before alert message comes up)?

if(document.getElementById)
{
//Put delay of 5 seconds here
alert("message");
}

arnyinc
02-19-2003, 01:28 PM
setTimeout("alert('message')", 5000);

florida
02-19-2003, 07:32 PM
Thanks