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("DOMConte开发者_高级运维ntLoaded", Logger, false)
Any advice?
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.com/jsref/met_win_settimeout.asp
精彩评论