您现在的位置是:首页 > 学无止境> JS网站首页学无止境JS

JS倒计时跳转

js   倒计时  
简介JS倒计时跳转

<html>
<head>
<title>5秒后跳转</title>
<script language=”javascript” type=”text/javascript”>
var i = 5;
var intervalid;
intervalid = setInterval(“fun()”, 1000);
function fun() {
if (i == 0) {
window.location.href = “http://www.studyfx.cn”;
clearInterval(intervalid);
}
document.getElementById(“mes”).innerHTML = i;
i–;
}
</script>
</head>
<body>
<p>将在 <span id=”mes”>5</span> 秒钟后返回首页!</p>
</body>
</html>

Top