1. 程式人生 > >html meta標簽實現頁面跳轉

html meta標簽實現頁面跳轉

sdn 頁面跳轉 com sharp clear ati else 跳轉 nbsp

refresh用於刷新與跳轉(重定向)頁面
refresh出現在http-equiv屬性中,使用content屬性表示刷新或跳轉的開始時間與跳轉的網址

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="refresh" content="5;url=http://www.w3school.com.cn">
    <title>Title</title>
    <script type="text/javascript">
        window.onload = function () {
            var i = 4;
            var tim = document.getElementById("timers");
            var timer = setInterval(function () {
                if (i == -1) {
//                    window.location.href="http://blog.csdn.net/kill_bugs";
                    clearInterval(timer);
                } else {
                    tim.innerHTML = i;
                    --i;
                }
            }, 1000);

        }
    </script>
</head>
<body>
<p>
    對不起。我們已經搬家了。您的 URL 是 <a href="http://www.w3school.com.cn">http://www.w3school.com.cn</a>
</p>

<p>您將在 <span class="timeShow" id="timers">5</span> 秒內被重定向到新的地址。</p>

<p>如果超過 5 秒後您仍然看到本消息,請點擊上面的鏈接。</p>
</body>
</html>

  

html meta標簽實現頁面跳轉