脚本自动跳转页面

来源:互联网 发布:新版淘宝充值话费 编辑:程序博客网 时间:2024/04/30 11:09
 

系统已停止使用,在<span id="totalSecond">5</span>秒后将会跳到新的系统。

 <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.replace("http://www.baidu.com");


        } else
        {
            if (navigator.appName.indexOf("Explorer") > -1)
            {
                document.getElementById('totalSecond').innerText = second--;
            } else
            {
                document.getElementById('totalSecond').textContent = second--;
            }
        }
    }
</script>