javascript - Call function first time after specified time interval - Stack Overflow

I am using Firefox and I want to call a function (Logger) 10 seconds after the page has loaded. I am us

I am using Firefox and I want to call a function (Logger) 10 seconds after the page has loaded. I am using this code

if (document.addEventListener)
  document.addEventListener("DOMContentLoaded", Logger, false)

Any advice?

I am using Firefox and I want to call a function (Logger) 10 seconds after the page has loaded. I am using this code

if (document.addEventListener)
  document.addEventListener("DOMContentLoaded", Logger, false)

Any advice?

Share Improve this question asked Nov 7, 2010 at 8:17 RefRef 331 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You can do like this:

window.onload = function(){
  setTimeout("func_name", 10000);
};

Where func_name is normal function:

function func_name(){
 // code here...
}

Or you can even do this:

window.onload = function(){
  setTimeout(function(){
     // your code...
  }, 10000);
};

More Info:

  • http://www.w3schools./jsref/met_win_settimeout.asp

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745477039a4629391.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信