1. 程式人生 > >javascript 過幾秒自動跳轉

javascript 過幾秒自動跳轉

<html>
<head>
    <title>404</title>
</head>
<body>


<h4 class="refresh_text">頁面沒有找到,<strong id="second_show">5</strong>秒鐘之後將帶您進入首頁。</h4>

<script type="text/javascript">
    var timeout = 5;
    function showError() {
        document.getElementById("second_show"
).innerHTML = timeout; timeout--; if (timeout == 0) { window.location.href = "http://www.baidu.com"; } else { setTimeout("showError()", 1000); } } showError();
</script> </body> </html>