30分钟误操作提示 您因长时间未进行操作导致页面过期

<p>&lt;!doctype html&gt;Document</p>
<div id="timers" class="timer">&nbsp;</div>
<script type="text/javascript">// <![CDATA[
var t = document.getElementById('timer');
var timer = 1800;
setInterval(function(){
timer--;
if(timer > 0){
document.getElementById("timers").innerHTML=timer;
}else{
clearInterval();
}
},1000);



var count = 0;
var outTime=30;//分钟
window.setInterval(go, 1000);
function go() {
count++;
console.log(count);
if (count == outTime*60) {
alert("您因长时间未进行操作导致页面过期");
}
}

var x ;
var y ;
//监听鼠标
document.onmousemove = function (event) {
var x1 = event.clientX;
var y1 = event.clientY;
if (x != x1 || y != y1) {
count = 0;
}
x = x1;
y = y1;
};

//监听键盘
document.onkeydown = function () {
count = 0;
};
// ]]></script>

原文地址:https://www.cnblogs.com/yakirtao/p/8471613.html