see7di
<script>
timefly
= 60000; //超时时间
activeDt = new Date();//得到当前时间放入变量作为初始时间
gotourl = "http://www.7di.net"//需要跳转的地址
setInterval("checkTime()",1000);//每间隔1000毫秒执行checkTime函数检查是否超时
document.onmousemove = retime;//当鼠标移动
document.onkeypress = retime;//当鼠标点击重新获取当前时间放入变量作为初始时间
function retime(){
   activeDt
= new
Date();
}
function
checkTime(){
dt
= new Date();//得到当前时间放入变量

if((dt-activeDt)>timefly)location.href=gotourl;//如果当前时间减去初始时间大于超时时间,就执行自动跳转
}
</script>

分类:

技术点:

相关文章:

  • 2021-09-12
  • 2021-12-03
  • 2022-02-19
  • 2021-11-22
  • 2021-05-03
  • 2021-09-19
  • 2021-10-29
  • 2021-06-20
猜你喜欢
  • 2021-12-31
  • 2021-12-28
  • 2021-12-03
  • 2021-11-24
  • 2021-11-28
  • 2021-10-19
  • 2022-01-07
相关资源
相似解决方案