<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-05-29 01:07:27 網頁設計 我要投稿
            • 相關推薦

            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='http://liting6680.blog.163.com/blog/hello.html'", 5000);

              // --></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='http://liting6680.blog.163.com/blog/hello.html';

              }

              // --></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='http://liting6680.blog.163.com/blog/hello.html';

              }

              // --></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";

              }

              // --></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='http://liting6680.blog.163.com/blog/hello.html';

              } else

              {

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

              {

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

              } else

              {

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

              }

              }

              }

              // --></mce:script>

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

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

            PHP中實現頁面跳轉07-06

            PHP頁面跳轉實現技巧04-23

            PHP頁面跳轉幾種實現技巧07-26

            java servlet頁面跳轉的方法03-30

            如何使用JavaScript實現頁面定時跳轉04-02

            PHP頁面跳轉的技巧03-19

            php頁面緩存實現方法07-20

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

            <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>
                      黄色视频在线观看