js 实现倒数几秒自动跳转

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.     <head>
  4.     <title></title>
  5.     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6.     <script type="text/javascript">
  7.         function tiao() {
  8.               clearInterval(mytime);
  9.              window.location.href="index.html";
  10.         }
  11.         setTimeout("tiao()",5000);
  12.         function changeSec() {
  13.                //得到myspan值
  14.                $('myspan').innerText=$('myspan').innerText-1;
  15.         }
  16.         function $(id) {
  17.             return document.getElementById(id);
  18.         }
  19.             var mytime = setInterval("changeSec()",1000);
  20.         </script>
  21.     </head>
  22.     <body>
  23.      <h2>登录成功,<span id="myspan" style="color:red;"></span>秒后自动跳转到管理页面  </h2>
  24.     </body>
  25.  </html>
 

发表评论

目前评论:1