当前位置: 代码迷 >> JavaScript >> js三秒自动跳转
  详细解决方案

js三秒自动跳转

热度:185   发布时间:2013-11-08 17:52:01.0
js3秒自动跳转
<html>
 <head>
  <title> New Document </title>
<script language="javascript">   
function init(){
window.setInterval("settime()",1000);   
window.setInterval("skipUrl()",3000);   
}  
function settime(){   
var divinner=document.getElementById("divinner");
if(divinner.innerText>1){
divinner.innerText = divinner.innerText-1;   
}
}
function skipUrl(){
var f_url='http://www.baidu.com';
window.location.replace(f_url);  
}   
</script>  
 </head>
 <body onload="init();">
  <div id="divinner">3</div>
 </body>
</html>
  相关解决方案