SetTimeout calls a method every 3 seconds - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setTimeout

Description

SetTimeout calls a method every 3 seconds

Demo Code

ResultView the demo in separate window

<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.c  om*/
function myfunction() {
    window.setTimeout(function() {
        console.log('I waited for you.')
    }, 3000);
}
myfunction();
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials