$(function())等同于$(document).ready(function()),意思很简单,就是等页面加载完毕之后,才开始执行函数。
$(function(){//五分钟无操作,返回系统首页,timeToreturn.js
function timeToReturn(){
window.location.href = "http://localhost:8080/zhongCourt/";
}
var nowtime = Date.parse(new Date());
var timeend = Date.parse(new Date());
$("body").click(function(){
nowtime = Date.parse(new Date());
console.log("nowtime" + nowtime);
});
function check(){
timeend = Date.parse(new Date());
console.log("check");
if((timeend - nowtime) > 300000){
timeToReturn();
}
setTimeout(check,10000);
}
setTimeout(check,10000);
})