js 当页面在一定时间没有操作后跳转页面

	    var maxTime = 5; // seconds
	    var time = maxTime;
	    $('body').on('keydown mousemove mousedown', function(e){
	        time = maxTime; // reset
	    });
	    var intervalId = setInterval(function(){
	        time--;
	        if(time <= 0) {
	            ShowInvalidLoginMessage();
	            clearInterval(intervalId);
	        }
	    }, 1000)
	    function ShowInvalidLoginMessage(){
	        window.location.href="http://www.baidu.com";
	    }
	    function reload1(){
	      time = maxTime; // reset**加粗样式**
	    }
发布了4 篇原创文章 · 获赞 3 · 访问量 2475

猜你喜欢

转载自blog.csdn.net/ZQ960214/article/details/83451634