Jacklovely
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <title>10秒后跳转</title>
 5     <script type="text/javascript">
 6         onload = function () {
 7             //秒数每秒减1
 8             var countDown = setInterval(function () {
 9                 var second = document.getElementById("second");
10                 second.innerHTML -= 1;
11                 //秒数为0时跳转到百度
12                 if (second.innerHTML == 0) {
13                     clearInterval(countDown);
14                     location.href = "http://www.baidu.com";
15                 }
16             }, 1000);
17         }
18     </script>
19 </head>
20 <body>
21     <p>
22         页面将在<span id="second">3</span>秒后跳转
23     </p>
24 </body>
25 </html>

 

posted on 2016-04-04 16:43  Jacklovely  阅读(575)  评论(0编辑  收藏  举报

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-04
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-13
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案