<!DOCTYPE html>
<head>
<title>5秒之后跳转到首页</title>
<style>
p{
text-align: center;
}
span{
color: red;
}
</style>
</head>
<body>
<p>
<span id="time">5</span>秒之后跳转到首页.......
</p>
<script>
var t=5;
var x=document.getElementById("time");
function showTime(){
--t;
if(t<=0){
location.href="https://ww.baidu.com"
}
x.innerHTML=t;
}
setInterval(showTime,1000);
</script>
</body>
</html>
5秒之后跳转到首页
最新推荐文章于 2022-06-22 15:39:17 发布