Jump to content

SetTimeout Function problem


harshpandya

Recommended Posts

Here is my code - I want Function test to execute only after 5 seconds.function test(){alert("After 5 sec");}function f2(){ setTimeout(test,500); }Problem is - Instead of 5 seconds delay - this program gives about 2 secods delay - which is very wired. Please Help Thanks,

Link to comment
Share on other sites

The unit is miliseconds. 5 seconds is 5000 miliseconds, not 500, that's half a second.function test(){alert("After 5 sec");}function f2(){setTimeout("test()",5000);}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...