一、实现HTML自动跳转到另一个网页
1.用标签meta实现
优点:简单
缺点:兼容性差
<metahttp-equiv="refresh" content="5;url=hello.html">//5秒后自动跳转
2. javascript的实现
优点:灵活
缺点:受不同浏览器的影响
<script language="javascript"type="text/javascript">
window.location.href='hello.html'; // 以下方式直接跳转
setTimeout("javascript:location.href='hello.html'", 5000);// 以下方式定时跳转
</script>
3.优化版js
<spanid="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='hello.html';
}
</script>