<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script language="javascript">
var DEFAULT_TIME_OUT=20; //10 minutes
var timeout =DEFAULT_TIME_OUT;
function refreshTime(){
alert('refresh');
timeout =DEFAULT_TIME_OUT;
}
function checkTimeout(){
timeout--;
if(timeout<0)
alert('TO LOGIN!')
}
function addEvent(name){
var allFrames = document.getElementsByTagName("frame");
allFrames[name].document.body.onmousemove = function() { parent.refreshTime(); }
} window.onload = function(){
window.setInterval("checkTimeout()",1000);//设置该页面每秒钟执行一次checkTimeout()方法。
} </script>
</head>
<frameset rows="60,*" framespacing="0" border="0" frameborder="0">
<frame name="banner" scrolling="no" target="contents" src="top.jsp" noresize onload="addEvent('banner');">
<frameset cols="110,*">
<frame name="contents" target="main" src="1.jsp" scrolling="no" noresize onload="addEvent('contents');"> <frameset rows="*,37" >
<frame name="main" src="2.jsp" scrolling="auto" noresize onload="addEvent('main');">
<frame name="buttom" target="main" src="3.jsp" scrolling="no" noresize onload="addEvent('buttom');">
</frameset>
</frameset>
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
上边是从网上找了点如何在系统中判断用户是否在操作,如果5分钟没有操作 就T下线。
如果用户最小化了系统也认为没有操作,不知说清楚了没
高手帮忙
// 这里即是键盘的按下事件,可以在这里重设timeout的值,或者重设setInterval
};IE是不支持contentDocument属性的,可以通过document.getElementById().contentWindow.document来获取frame的document对象,相当于contentDocument属性。希望我的回答对你有所帮助