J2EE社區(qū)

          茍有恒,何必三更起五更眠;
          最無(wú)益,只怕一日曝十日寒.
          posts - 241, comments - 318, trackbacks - 0, articles - 16

          導(dǎo)航

          留言簿(30)

          隨筆分類(219)

          友情鏈接

          搜索

          •  

          積分與排名

          • 積分 - 1166754
          • 排名 - 25

          最新隨筆

          最新評(píng)論

          閱讀排行榜

          功能:5秒后,自動(dòng)跳轉(zhuǎn)到同目錄下的02view.html文件
           
          1)html的實(shí)現(xiàn)
          <head>
          <meta http-equiv="refresh" content="5;url=02view.html">
          </head>

          優(yōu)點(diǎn):簡(jiǎn)單
          缺點(diǎn):Struts Tiles中無(wú)法使用
           
          2)javascript的實(shí)現(xiàn)
          <script language="javascript" type="text/javascript">
             setTimeout(
          "javascript:location.href='02view.html'"5000); 
          </script>

          優(yōu)點(diǎn):靈活,可以結(jié)合更多的其他功能
          缺點(diǎn):受到不同瀏覽器的影響
           
          3)結(jié)合了倒數(shù)的javascript實(shí)現(xiàn)(IE)
          <span id="totalSecond">5</span>

          <script language="javascript" type="text/javascript">
          var second = totalSecond.innerText;
          setInterval(
          "redirect()"1000);
          function redirect(){ 
          totalSecond.innerText
          =--second; 
          if(second<0) location.href='02view.html';
          }
          </script>

          優(yōu)點(diǎn):更人性化
          缺點(diǎn):firefox不支持(firefox不支持span、div等的innerText屬性)
           
          3')結(jié)合了倒數(shù)的javascript實(shí)現(xiàn)(firefox)
          <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 = '02view.html';
              }
          </script>

          4)解決Firefox不支持innerText的問題
          <span id="totalSecond">5</span>

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

          5)整合3)和3')
          <span id="totalSecond">5</span>

          <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 
          = '02view.html';
                  } 
          else
                  {
                      
          if (navigator.appName.indexOf("Explorer"> -1)
                      {
                          document.getElementById('totalSecond').innerText 
          = second--;
                      } 
          else
                      {
                          document.getElementById('totalSecond').textContent 
          = second--;
                      }
                  }
              }
          </script>



          名稱: ?4C.ESL | .↗Evon
          口號(hào): 遇到新問題?先要尋找一個(gè)方案乄而不是創(chuàng)造一個(gè)方案こ
          mail: 聯(lián)系我


          Feedback

          # re: 一些頁(yè)面自動(dòng)跳轉(zhuǎn)的實(shí)現(xiàn)   回復(fù)  更多評(píng)論   

          2009-03-05 18:45 by 44you
          不錯(cuò)

          # re: 一些頁(yè)面自動(dòng)跳轉(zhuǎn)的實(shí)現(xiàn)   回復(fù)  更多評(píng)論   

          2009-03-06 07:47 by Rui
          學(xué)習(xí)了:)

          # re: 一些頁(yè)面自動(dòng)跳轉(zhuǎn)的實(shí)現(xiàn)   回復(fù)  更多評(píng)論   

          2009-03-06 09:28 by 曉江小子
          我可以轉(zhuǎn)載么。。。。

          # re: 一些頁(yè)面自動(dòng)跳轉(zhuǎn)的實(shí)現(xiàn)   回復(fù)  更多評(píng)論   

          2009-05-17 02:36 by xiter
          不錯(cuò) 支持

          # re: 一些頁(yè)面自動(dòng)跳轉(zhuǎn)的實(shí)現(xiàn)   回復(fù)  更多評(píng)論   

          2009-11-27 18:20 by 第三方
          范甘迪
          主站蜘蛛池模板: 桦川县| 曲麻莱县| 富蕴县| 万州区| 徐州市| 明星| 闵行区| 比如县| 乾安县| 崇左市| 临洮县| 武清区| 郁南县| 晋城| 建德市| 仙居县| 交口县| 平顺县| 正镶白旗| 西丰县| 于田县| 沧州市| 太湖县| 乌苏市| 丘北县| 青阳县| 西和县| 连城县| 玛纳斯县| 咸丰县| 葫芦岛市| 华坪县| 阳曲县| 石门县| 蒙阴县| 开远市| 景东| 麻阳| 印江| 台安县| 岳西县|