Window setInterval() Method - Call a "named" function every 3 seconds - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setInterval

Description

Window setInterval() Method - Call a "named" function every 3 seconds

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials