开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜