Javascript examples for Browser Object Model:Window setTimeout
Add a 10 second pause timeout
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/*w w w. j a v a2 s . c o m*/ function timeoutLoop(i, max, callback) { if (i < max) { callback(i); i++; setTimeout(function(){ timeoutLoop(i, max, callback);}, 2000); } } timeoutLoop(0, 20, function(i) { document.write("Iteration " + i + "<br>"); }); }); </script> </head> <body> </body> </html>