夜间福利网站,免费动漫av,一级做a爰片久久毛片免费陪,夜夜骑首页,黄色毛片视频,插插插操操操,综合av色

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

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

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

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

  1)html的實現(xiàn)

  代碼如下:

  <head>

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

  </head>

  優(yōu)點:簡單

  缺點:Struts Tiles中無法使用

  2)javascript的實現(xiàn)

  代碼如下:

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

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

  /pic/mce:script>

  優(yōu)點:靈活,可以結合更多的其他功能

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

  3)結合了倒數(shù)的javascript實現(xiàn)(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>

  優(yōu)點:更人性化

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

  3 )結合了倒數(shù)的javascript實現(xiàn)(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實現(xiàn)頁面自動跳轉的方法有哪些(實例)】相關文章:

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

PHP中實現(xiàn)頁面跳轉01-31

PHP頁面跳轉實現(xiàn)技巧10-12

PHP頁面跳轉幾種實現(xiàn)技巧09-04

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

如何使用JavaScript實現(xiàn)頁面定時跳轉11-10

PHP頁面跳轉的技巧03-19

php頁面緩存實現(xiàn)方法12-13

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