直接上代码:

window.onload = function () {
initScreenSaver();
} //0912 add
function ScreenSaver(settings){ this.settings = settings; this.nTimeout = this.settings.timeout; document.body.screenSaver = this;
// link in to body events
document.body.onmousemove = ScreenSaver.prototype.onevent;
document.body.onmousedown = ScreenSaver.prototype.onevent;
document.body.onkeydown = ScreenSaver.prototype.onevent;
document.body.onkeypress = ScreenSaver.prototype.onevent; var pThis = this;
var f = function(){pThis.timeout();}
this.timerID = window.setTimeout(f, this.nTimeout);
}
ScreenSaver.prototype.timeout = function(){
if ( !this.saver ){
window.history.back(-1)//无动作跳转地址
}
}
ScreenSaver.prototype.signal = function(){
if ( this.saver ){
this.saver.stop();
} window.clearTimeout(this.timerID); var pThis = this;
var f = function(){pThis.timeout();}
this.timerID = window.setTimeout(f, this.nTimeout);
} ScreenSaver.prototype.onevent = function(e){
this.screenSaver.signal();
} var saver;
function initScreenSaver(){
saver = new ScreenSaver({timeout:20000}); //无动作时间
}

最新文章

  1. JavaScript学习笔记-表达式和语句
  2. [Cocos2D-x For WP8]ParallaxNode视差
  3. 解决ArcGIS API for Silverlight 加载地图的内外网访问问题
  4. hql语句理解2
  5. 《同一个类中不同方法之间的调用相关问题(省略的类名或者this)》
  6. [转载]求平方根sqrt()函数的底层算法效率问题
  7. 数据分析≠Hadoop+NoSQL,不妨先看完善现有技术的10条捷径(分享)
  8. Java——(六)Collection之Queue集合
  9. PHP扩展开发(2) - VS2013环境搭建
  10. 第2阶段——编写uboot之硬件初始化和制作链接脚本lds(1)
  11. [struts2学习笔记] 第四节 学着使用struts 2的tag标签
  12. linux基础-系统安装教程篇(centos6.5)
  13. Flask框架简介,常用扩展包及两大核心
  14. 通过Cloudera Manager部署CDH5.15.1的webUI界面详解
  15. ASP.NET MVC中MaxLength特性设置无效
  16. linux上源码编译安装mysql-5.6.28
  17. SpringBoot+SpringAOP+Java自定义注解+mybatis实现切库读写分离
  18. 【甘道夫】HBase基本数据操作详解【完整版,绝对精品】
  19. PEP8 Python 编码规范整理(转)
  20. Java基础教程(13)--包

热门文章

  1. 利用requests提交相同名称数据的处理方法
  2. Python与用户的交互
  3. python + Pyglet ---播放视频
  4. 13-Perl 子程序(函数)
  5. docker基础知识
  6. jdbc原生操作数据库
  7. Java虚拟机-------垃圾回收机机制
  8. XSS防御和绕过1
  9. Spring的核心jar包
  10. Win7系统打开防火墙出现0x6D9错误的解决方法