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实现简单跳转

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-10-25
  • 2021-11-22
  • 2022-01-03
  • 2021-09-12
猜你喜欢
  • 2021-12-17
  • 2021-12-28
  • 2021-10-13
  • 2021-12-03
  • 2022-12-23
相关资源
相似解决方案