Javascript examples for Browser Object Model:Window setInterval
Set intervals for setTimeout() function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w .jav a2 s .co m*/ (function(){ var intervals = [1,1,1,4,3,7]; (function update(next){ document.body.innerHTML = new Date(); setTimeout(function(){ update((next + 1)%intervals.length); }, intervals[next]*1000); })(0); })(); } </script> </head> <body> </body> </html>