5S后页面跳转

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script type="text/javascript">
window.onload=function(){
var demo=document.getElementById("demo");
var count=5; //倒计时5秒;
setTimeout(fn,1000);
function fn(){
count--;
demo.innerHTML="本页面将在"+count+"秒之后跳转";
// 如果等于0秒,页面自动跳转到新页面
if(count<=0){
window.location.href="http://www.cnblogs.com/zhaocong/p/6947201.html";
}else{
setTimeout(fn,1000);s
}
}
}
</script>
</head>
<body>
<div id="demo"></div>

</body>
</html>

原文地址:https://www.cnblogs.com/zhaocong/p/6947547.html