一分钟不操作自动将页面跳转到另一个页面

一分钟不操作自动将页面跳转到另一个页面

<script>  
  function   go()  
  {  
  location.href="index.html";  
  }  
  function   notgo()  
  {  
  clearTimeout(mygo);  
  mygo=setTimeout(go,60000);  
  }  
  document.οnmοuseοver=notgo;  
  document.οnmοusemοve=notgo;  
  document.οnmοuseοut=notgo;  
  document.οnmοusedοwn=notgo;  
  document.οnmοuseup=notgo;  
  document.οnkeydοwn=notgo;  
  mygo=setTimeout(go,60000);  
  </script>

 

以下是15秒后页面自动跳转的另一种写法

<script>  
  <!--    
  var   limit="0:15"  
  if   (document.images){  
  var   parselimit=limit.split(":")  
  parselimit=parselimit[0]*60+parselimit[1]*1  
  }  
  function   beginrefresh(){  
  if   (!document.images)  
  return  
  if   (parselimit==1)  
  window.location.href="index.html"  
  else{    
  parselimit-=1  
  curmin=Math.floor(parselimit/60)  
  cursec=parselimit%60  
  if   (curmin!=0)  
  curtime=curmin+"分"+cursec+"秒后转向!"  
  else  
  curtime=cursec+"秒后转向!"  
  window.status=curtime  
  setTimeout("beginrefresh()",1000)  
  }  
  }  
  window.οnlοad=beginrefresh  
  //-->  
  </script>

 

 

 


转载于:https://www.cnblogs.com/maxthon/archive/2009/01/13/1374632.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值