<script> var count = 0; var outTime = 1;//分鐘 window.setInterval(go, 1000); function go() { count++; if (count == outTime * 60) { // alert("設置時長N分鐘無鼠標鍵盤操做,自動跳轉下一個頁面"); window.location.href = "tianjin.html?backurl=" + window.location.href; } } 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>