javascript倒计时 页面跳转

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <title>Count</title> 
    </head> 
    <body> 
 
<div style="text-align: center " >Enter baidu in
<span id="totalSecond" style="text-align: center ;font-family: GulimChe;font-size: 100px;">5
</span>seconds </div> 
 
<script language="javascript" type="text/javascript"> 
    var second = document.getElementById(totalSecond).textContent; 
 
    if (navigator.appName.indexOf("Explorer") > -1) 
    { 
        second = document.getElementById(totalSecond).innerText; 
    } else 
    { 
        second = document.getElementById(totalSecond).textContent; 
    } 
 
 
    setInterval("redirect()", 1000); 
    function redirect() 
    { 
        if (second < 0) 
        { 
            location.href = www.baidu.com; //go to baidu
        } else 
        { 
            if (navigator.appName.indexOf("Explorer") > -1) 
            { 
                document.getElementById(totalSecond).innerText = second--; 
            } else 
            { 
                document.getElementById(totalSecond).textContent = second--; 
            } 
        } 
    } 
</script> 
    </body> 
</html> 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。