网页上10秒倒计时,完了后就自动跳转到另一个网页上html代码

时间:2023-12-04 22:27:44
用html代码的话就这样:
<meta http-equiv="Refresh" content="10;URL=http://www.baidu.com"> 
把它加到head标签下
但是不能实现倒计时效果,如果要实现倒计时的话就要用flash,或者javascript,我把带js的html代码发给你自己粘贴到记事本试试吧
<html>
<head>
<title>10秒后跳转</title>
</head> <body>
<input type="text" readonly="true" value="10" id="time">
</body>
<script language="javascript">
var t = 10;
var time = document.getElementById("time");
function fun(){
t--;
time.value = t;
if(t<=0){
location.href = "http://www.baidu.com";
clearInterval(inter);
}
}
var inter = setInterval("fun()",1000);
</script>
</html>