隨筆-51  評論-14  文章-0  trackbacks-0

          javascript的頁面跳轉代碼

          方法一(動畫效果):
          <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
          <meta 
          http-equiv="Content-Type" content="text/html; charset=gb2312" />
          <title>
          Loading</title>
          </head>

          <body>

          <form 
          name="loading">

          <p 
          align="center">正在跳轉,請稍后...</p>

          <p 
          align="center">
          <input 
          type="text" name="bar" style="border-style:none; background-color:#D3E8D0; font-weight:bold" />
          <input 
          type="text" name="percentage"style="border-style:none; background-color:#FFFFFF; max-width:30px"/>
          </p>

          <p 
          align="center">
          如果您的瀏覽器不支持跳轉,請點擊<a href="http://www.126.com">這里</a>手動跳轉
          </p>

          <script 
          language="javascript" type="text/javascript">  
          var percent=0;          //百分比進度,顯示在滾動條后面
          var element="||";      //滾動條單元豎線
          var elements="||";    //滾動條當前豎線
          count();                //開始調用循環

          function count(){  
              percent=percent+
          10;    //每次百分比加10
              
          elements =elements + element;  //滾動條當前豎線增加一個滾動條單元豎線
              
          document.loading.bar.value=elements;  //設置窗體loading表單中bar元素的當前值
              
          document.loading.percentage.value=percent+"%";  //設置窗體loading表單中percentage元素的當前值
              
          if (percent<99){                    //percent小于99則繼續循環
                  
          setTimeout("count()",500);        //每500ms進行一次count()
              
          }  
              
          else{
                  window.location = 
          "http://www.126.com";    //percent達到100時跳轉
              
          }  
          }
          </script>
           
          </form>
          </body>
          </html>


          方法二:
          <html>
          <head>
          <meta 
          http-equiv="refresh" content="3; url=http://www.126.com">
          </head>
          <a 
          href="http://www.126.com">如果您的瀏覽器沒有自動跳轉,請點擊這里<a/>
          </html>
          posted on 2008-06-16 18:16 Hank1026 閱讀(1021) 評論(0)  編輯  收藏 所屬分類: 每日積累
          主站蜘蛛池模板: 宾阳县| 兴山县| 彰武县| 蓬莱市| 饶河县| 宣汉县| 锡林郭勒盟| 望城县| 中牟县| 连平县| 禄劝| 漳州市| 辉县市| 桐柏县| 兰溪市| 蓬莱市| 原平市| 都昌县| 镇赉县| 东乡族自治县| 房山区| 梧州市| 淮安市| 聂拉木县| 万安县| 博客| 秭归县| 涿鹿县| 封丘县| 民丰县| 徐州市| 大英县| 阿图什市| 依兰县| 井研县| 涪陵区| 台东市| 沁水县| 泗阳县| 休宁县| 海盐县|