javascript 倒计时跳转.

 <!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
var t = 5;//设定跳转的时间
var intervalId = setInterval("refer()", 1000); //启动1秒定时
function refer() {
if (t-- == 0)
location.href = "./h.html"; //设定跳转的链接地址
document.getElementById('show').innerHTML = "" + t + "秒后自动跳转到指定页面"; //显示倒计时
} function ref() {
clearInterval(intervalId); //解除倒计时.
location.href = "./h.html"; //设定跳转的链接地址
}
</script>
</head>
<body>
<span id="show"></span>
<input type="button" value="手动跳转" onclick="ref()">
</body>
</html>
上一篇:ASP.NET MVC开发必看系列


下一篇:Java Thread.join()方法