js模拟系统无刷新跳回登录页1

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>

<body>

<div>
<button>点击</button>
</div>

<script language="javascript">
var myTime = setTimeout("Timeout()", 3000);

function resetTime() {
clearTimeout(myTime);
// myTime = setTimeout('Timeout()', 5000);
}

function Timeout() {
document.location.href = 't1.html';
}
document.documentElement.onkeydown = resetTime;
document.doocumentElement.onclick = resetTime;
</script>
</body>

</html>
原文地址:https://www.cnblogs.com/mx2036/p/9493893.html