js实现指定时间跳转到另一个页面


 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <title>setTimeout</title>
 5 </head>
 6 <body>
 7 <h1>跳转页面</h1>
 8 <form>
 9     <div>
10         <p><span id="skip"></span>秒后跳转到主页面</p>
11     </div>
12 </form>
13 <script type="text/javascript">
14     var t = 5;
15     function showTime() {
16         t -= 1;
17         document.getElementById('skip').innerHTML = t;
18         if (t == 0) {
19             window.location.href = 'http://www.baidu.com';
20         }
21         setTimeout("showTime()",1000);
22     }
23     showTime();
24 </script>
25 </body>
26 </html>
js实现简单跳转

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM