html meta標簽實現頁面跳轉


 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>

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM