Javascript examples for Browser Object Model:Window setTimeout
separate function with Javascript code to set Timeout?
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w w w. jav a 2s . c om*/ function my() { this._timeout = function(){ setTimeout(function(){ comparePanel(); }, 3000); }; } function comparePanel() { console.log('hi'); } var toc = new my(); toc._timeout(); } </script> </head> <body> </body> </html>