Web
The current article is taken from javascript.faqts
Contributors: ha mo, Daniel LaLiberte, Brent Boyer, Martin Honnen, mercury rising,
There is no true wait, sleep, or similar function in either the core JavaScript language or in client side JavaScript. Client side JavaScript however provides setTimeout('js code here', delayInMilliseconds) which allows you to schedule execution of piece of script and setInterval('js code here', intervalInMilliseconds) which allows you to periodically execute a piece of script. So if you wanted (pseudo code) statement1; wait (someDelay); statement2; you would stuff the code into functions: function statement1 () { // your code here } function statement2 () { // your code here }
and call statement1(); setTimeout('statement2()', someDelay); If you wanted (pseudo...