首页 > 代码库 > 5S后页面跳转
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秒;
setInterval(fn,1000);
function fn(){
count--;
demo.innerHTML="本页面将在"+count+"秒之后跳转";
// 如果小于等于5秒,页面自动跳转到新页面
if(count<=0){
window.location.href="http://www.cnblogs.com/zhaocong/p/6947201.html";
}else{
setInterval(fn,1000);
}
}
}
</script>
</head>
<body>
<div id="demo"></div>
</body>
</html>
5S后页面跳转