代码改变世界

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

2018-08-17 16:12  笨笨03  阅读(169)  评论(0编辑  收藏  举报
<!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>