<body>
<h1>页面将在 <span style="font-size: 30px;color: red"> <span id="n">5 </span></span>秒钟后跳转</h1>
<script>
var timer = setInterval(show,1000);
var n = 5;
function show(){
// console.log(Math.random());
if(n>0){
n--;
document.getElementById("n").innerText = n;
}else{
clearInterval(timer);
location.href = "http://www.baidu.com";
}
// console.log(Math.random());
}
// setTimeout(f,5000);
// function f() {
// location.href = "http://www.baidu.com";
// }
</script>
</body>