开发者

How do I go to a link after 5 seconds in javascript

Ho开发者_高级运维w would I make it so after a certain amount of time, a script will link to lets say href="index.jpg" rel="lightbox" class="blah";

Then soon after go to the next link after another 5 seconds etc..


You will want to use the setTimeout function to implement this:

Executes a code snippet or a function after specified delay.


If you want to do it once use setTimeout. if you want to do it over and over use setInterval

This example will call myfunc() after 5 seconds (5000 milliseconds)

setTimeout("myfunc()", 5000);

function myfunc()
{
   // do what you need to do here
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜