Delaying Javascript
How do I delay JavaScript - I tried the following but it doesn't delay??:
setTimeout(document.getElementById("loading1").innerHTML="", 4000);
开发者_运维百科
Thanks, B
try:
setTimeout(function(){document.getElementById("loading1").innerHTML="";}, 4000);
function setHtml() {
document.getElementById("loading1").innerHTML="";
}
setTimeout(setHtml, 4000);
You would want to put your code inside of a function:
setTimeout(function() { document.getElementById("loading1").innerHTML=""; }, 4000);
精彩评论