HTML js 页面倒计时后跳转至新页面

Posted 尾戒0717

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTML js 页面倒计时后跳转至新页面相关的知识,希望对你有一定的参考价值。

html

 1 <body>
 2     <p>操作错误!还有<span id="sp">5</span>秒跳转到交换机备份页面...</p>
 3   <a href="#" onclick="stop()">停止</a>
 4 
 5     <script type="text/javascript">
 6         var i=5;
 7         function changeTime(){
 8             document.getElementById("sp").innerHTML=i;
 9             i--;
10         }
11         changeTime();
12         var inId=window.setInterval("changeTime()",1000);
13         function stop(){
14             window.clearInterval(inId);
15         }
16         function autoRedirect(){
17             window.location="{% url ‘sw_mgmt:sw_br‘ %}";    //跳转页面设置
18         }
19         window.setInterval("autoRedirect()",5000);
20     </script>
21 
22 </body>

 

以上是关于HTML js 页面倒计时后跳转至新页面的主要内容,如果未能解决你的问题,请参考以下文章