av手机免费在线观看,国产女人在线视频,国产xxxx免费,捆绑调教一二三区,97影院最新理论片,色之久久综合,国产精品日韩欧美一区二区三区

網(wǎng)頁(yè)設(shè)計(jì)

HTML實(shí)現(xiàn)頁(yè)面自動(dòng)跳轉(zhuǎn)的方法有哪些(實(shí)例)

時(shí)間:2025-05-29 01:07:27 網(wǎng)頁(yè)設(shè)計(jì) 我要投稿
  • 相關(guān)推薦

HTML實(shí)現(xiàn)頁(yè)面自動(dòng)跳轉(zhuǎn)的方法有哪些(實(shí)例)

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

  1)html的實(shí)現(xiàn)

  代碼如下:

  <head>

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

  </head>

  優(yōu)點(diǎn):簡(jiǎn)單

  缺點(diǎn):Struts Tiles中無(wú)法使用

  2)javascript的實(shí)現(xiàn)

  代碼如下:

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

  setTimeout("javascript:location.href='http://liting6680.blog.163.com/blog/hello.html'", 5000);

  // --></mce:script>

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

  缺點(diǎn):受到不同瀏覽器的影響

  3)結(jié)合了倒數(shù)的javascript實(shí)現(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='http://liting6680.blog.163.com/blog/hello.html';

  }

  // --></mce:script>

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

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

  3 )結(jié)合了倒數(shù)的javascript實(shí)現(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='http://liting6680.blog.163.com/blog/hello.html';

  }

  // --></mce:script>

  4)解決Firefox不支持innerText的問(wèn)題

  代碼如下:

  <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實(shí)現(xiàn)頁(yè)面自動(dòng)跳轉(zhuǎn)的方法有哪些(實(shí)例)】相關(guān)文章:

HTML頁(yè)面3秒后自動(dòng)跳轉(zhuǎn)常見(jiàn)的3種方法05-10

PHP中實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)07-06

PHP頁(yè)面跳轉(zhuǎn)實(shí)現(xiàn)技巧04-23

PHP頁(yè)面跳轉(zhuǎn)幾種實(shí)現(xiàn)技巧07-26

java servlet頁(yè)面跳轉(zhuǎn)的方法03-30

如何使用JavaScript實(shí)現(xiàn)頁(yè)面定時(shí)跳轉(zhuǎn)04-02

PHP頁(yè)面跳轉(zhuǎn)的技巧03-19

php頁(yè)面緩存實(shí)現(xiàn)方法07-20

PHP頁(yè)面跳轉(zhuǎn)到另一個(gè)頁(yè)面的方法07-08