倒计时

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>倒计时五秒后跳页面</title>
    <script>
   function countDown(){
    //获取初始时间
    var time = document.getElementById("Time");
    //获取到id为time标签中的数字时间
    if(time.innerHTML == 0){
     //等于0时清除计时,并跳转该指定页面
                    window.location.href ="file:///E:/%E6%A1%8C%E9%9D%A2/%E5%B0%8F%E7%8E%A9%E6%84%8F/HTML5%E8%B7%91%E9%85%B7%E5%B0%8F%E6%B8%B8%E6%88%8F%E4%BB%A3%E7%A0%81/index.html";
    }else{
     time.innerHTML = time.innerHTML-1;
    }
   }
   //1000毫秒调用一次
   window.setInterval("countDown()",1000);
    </script>
    <style>
        #Time, #p {
            font-size: 150px;
            text-align: center;
        }
        #Font, #p {
            font-size: 100px;
            text-align: center;
        }
    </style>
</head>
<body>
    <font color="yellow"><p id="Time">5</p></font>
    <p id="Font">将跳转至主页</p>
</body>
</html>
posted @ 2020-07-09 19:46  我们好像在那见过  阅读(83)  评论(0编辑  收藏  举报