Proper way to call `setTimeout()` - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setInterval

Description

Proper way to call `setTimeout()`

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from   w w  w.  j ava 2s  .  c  o m
function setOpacity(seconds){
    console.log('seconds: ' + seconds);
}
setTimeout(function() {
    setOpacity(10);
}, 10000);
setTimeout(function() {
    setOpacity(1);
}, 1000);
    });

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

Related Tutorials