Javascript examples for Browser Object Model:Window setInterval
Window setInterval() Method - Call a "named" function every 3 seconds
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> var myVar;/*w w w .jav a 2 s.c o m*/ function myFunction() { myVar = setInterval(alertFunc, 3000); } function alertFunc() { console.log("Hello!"); } </script> </body> </html>