<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            HTML實現頁面自動跳轉的方法有哪些(實例)

            時間:2025-11-01 12:09:35 網頁設計

            HTML實現頁面自動跳轉的方法有哪些(實例)

              本文是百分網小編搜索整理的五個實例給大家介紹html如何實現頁面自動跳轉,感興趣的朋友一起學習吧!!想了解更多相關信息請持續關注我們應屆畢業生考試網!

              1)html的實現

              代碼如下:

              <head>

              <meta http-equiv="refresh" content="5;url=hello.html">

              </head>

              優點:簡單

              缺點:Struts Tiles中無法使用

              2)javascript的實現

              代碼如下:

              <mce:script language="javascript" type="text/javascript"><!--

              setTimeout("javascript:location.href='/pic/blog/hello.html'", 5000);

              /pic/mce:script>

              優點:靈活,可以結合更多的其他功能

              缺點:受到不同瀏覽器的影響

              3)結合了倒數的javascript實現(IE)

              代碼如下:

              <span id="totalSecond">5</span>

              <mce:script language="javascript" type="text/javascript"><!--

              var second = totalSecond.innerText;

              setInterval("redirect()", 1000);

              function redirect(){

              totalSecond.innerText=--second;

              if(second<0) location.href='/pic/blog/hello.html';

              }

              /pic/mce:script>

              優點:更人性化

              缺點:firefox不支持(firefox不支持span、p等的innerText屬性)

              3 )結合了倒數的javascript實現(firefox)

              代碼如下:

              <mce:script language="javascript" type="text/javascript"><!--

              var second = document.getElementById('totalSecond').textContent;

              setInterval("redirect()", 1000);

              function redirect()

              {

              document.getElementById('totalSecond').textContent = --second;

              if (second < 0) location.href='/pic/blog/hello.html';

              }

              /pic/mce:script>

              4)解決Firefox不支持innerText的問題

              代碼如下:

              <span id="totalSecond">5</span>

              <mce:script language="javascript" type="text/javascript"><!--

              if(navigator.appName.indexOf("Explorer") > -1){

              document.getElementById('totalSecond').innerText = "my text innerText";

              } else{

              document.getElementById('totalSecond').textContent = "my text textContent";

              }

              /pic/mce:script>

              5)整合3)和3')

              代碼如下:

              <span id="totalSecond">5</span>

              <mce: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.href='/pic/blog/hello.html';

              } else

              {

              if (navigator.appName.indexOf("Explorer") > -1)

              {

              document.getElementById('totalSecond').innerText = second--;

              } else

              {

              document.getElementById('totalSecond').textContent = second--;

              }

              }

              }

              /pic/mce:script>

            【HTML實現頁面自動跳轉的方法有哪些(實例)】相關文章:

            HTML頁面3秒后自動跳轉常見的3種方法10-20

            PHP中實現頁面跳轉01-31

            PHP頁面跳轉實現技巧10-12

            PHP頁面跳轉幾種實現技巧09-04

            java servlet頁面跳轉的方法10-22

            如何使用JavaScript實現頁面定時跳轉11-10

            PHP頁面跳轉的技巧03-19

            php頁面緩存實現方法12-13

            PHP頁面跳轉到另一個頁面的方法08-03

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看