您的位置:首页 > 其它

页面定时跳转(收集整理)

2016-03-10 15:54 148 查看
<!doctype html
<head>
<meta charset=utf-8" />
<title>js定时跳转页面的方法</title>
</head>
<body>
<script>
var t=10;//设定跳转的时间
setInterval("refer()",1000); //启动1秒定时
function refer(){
if(t==0){
location="http://www.baidu.com"; //#设定跳转的链接地址
}
document.getElementById('show').innerHTML=""+t+"秒后跳转到百度"; // 显示倒计时
t--; // 计数器递减
}
</script>
<span id="show"></span>
</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: