Jquery实现倒计时跳转到指定页面或关闭窗口

JavaScript代码:

 1     //设置超时时间为10秒钟
 2     var timeout = 10;
 3     function show() {
 4         var showbox = $(".showbox");
 5         showbox.html(timeout);
 6         timeout--;
 7         if (timeout == 0) {
 8             window.opener = null;
 9             window.location.href = "index.aspx";
10         }
11         else {
12             setTimeout("show()", 1000);
13         }
14     }

 源代码:下载

转载于:https://my.oschina.net/weisenz/blog/200642

猜你喜欢

转载自blog.csdn.net/weixin_34235105/article/details/91920883