在倒计时计时器结束后重定向到某个特定页面


Redirect to some specific page after ending countdown timer

在这段代码中,是否有可能在完成计时器后自动重定向到某个特定页面。

<blink>
    var timestatus = 1;
    function time_dec() {
        time_left--;
        document.getElementById('countdown').innerHTML = time_left;
        if (time_left == 0) {
            clearInterval(cinterval);
        }
    }
    function resumetime() {
        //time_left = 50;
        clearInterval(cinterval);
        cinterval = setInterval('time_dec()', 1000);
    }
    function defaultstart() {
        time_left = 50;
        clearInterval(cinterval);
        cinterval = setInterval('time_dec()', 1000);
    }
    defaultstart(); 
</script>
</head> 
    <body> 
        <span id="countdown">50</span>.
        <input type="button" value="stop" id="stopbutton" onclick="stopstarttime()">
    </body> 
</html>
</blink>

要在javascript中重定向,请使用:

window.location = "http://foo.com/foo";

这将重定向用户到foo.com/foo