admin管理员组文章数量:1426791
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 badges1 Answer
Reset to default 4You 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
本文标签: javascriptCall function first time after specified time intervalStack Overflow
版权声明:本文标题:javascript - Call function first time after specified time interval - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745477038a2660007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论