日期:2014-05-17  浏览次数:20807 次

做了个系统,如果在后台持续10分钟没有动作,系统就提示超时退出?
RT
实现这样的功能,怎么做啊?
谢谢,给个例子吧!!~~~

------解决方案--------------------
<script>
var tcount=0;
function CountTime() {
tcount++;
timeLeft=10 - tcount;
time.innerText = "还剩 " +timeLeft + "秒 ";
timer=window.setTimeout( "CountTime() ",1000);
if(timeLeft <=0){clearTimeout(timer);time.innerText= "倒计时完毕 ";}
}
</script>
<input type= "button " onclick= "CountTime() " value= "10秒 ">
<div id= "time "> </div>
<body>