Javascript examples for Browser Object Model:Window setInterval
Running functions after delay with setInterval
<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 a 2s.c om function funcOne() { console.log('one'); } function funcTwo() { console.log('two'); } function funcThree() { console.log('three'); } var i = 0; var funcs = [ funcOne, funcTwo, funcThree ]; setInterval(function() { funcs[i % funcs.length](); i++; }, 2000); } </script> </head> <body> </body> </html>