JavaScript中定时跳转网页
<script>
var demo = document.getElementById("demo");
var count = 5;
var speed = 1000;
setTimeout(goIndexPage,speed); //1秒钟之后执行 goIndexPage函数
function goIndexPage(){
count--;
demo.innerHTML="<a href='https://www.2678su.com'>"+count+"秒后自动跳转首页</a>";
if(count <=0){
window.location.href = "https://www.2678su.com"; //js页面跳转
}
else{
setTimeout(goIndexPage,speed); //递归调用,自己调用自己
}
}
</script>