1、通过meta refresh实现几秒后自动跳转

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Uoolo</title>
<meta http-equiv="refresh" content="3;url=http://www.uoolo.com/">
</head>
<body>
</body>
</html>

_ueditor_page_break_tag_

2.通过JavaScript实现自动跳转

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Uoolo</title>
<script type="text/javascript">
var time = 8; //时间,秒
function Redirect() {
   window.location = "http://www.uoolo.com/";
}
var i = 0;
function dis() {
   document.all.s.innerHTML = "还剩" + (time - i) + "秒";
   i++;
}
timer = setInterval('dis()', 1000); //显示时间
timer = setTimeout('Redirect()', time * 1000); //跳转
</script>
</head>
<body>
<span id="s"></span>
</body>
</html>


最后修改:2015 年 05 月 11 日
如果觉得我的文章对你有用,请随意赞赏