Determine the session expiration time - use JavaScript to display the remaining seconds <%@LANGUAGE=VBSCRIPT CODEPAGE=936%>
<%session.timeout=1440 'Unit (minute) 1440=24 hours The parameter cannot be greater than 24 hours, that is, it cannot be greater than 1440 minutes%>
<%
if session(login)<>888888 then' Determine whether the Session is valid
Response.Write(Session has expired)
end if
%>
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312 />
<title>Untitled Document</title>
<script>
var lefttime=6 //session time transfer
var tid
function x()
{
lefttime--
document.all.xx.innerText=Remaining:+lefttime + seconds
if(lefttime==0) {clearInterval(tid);document.all.xx.innerText=Login timed out}
}
tid = window.setInterval(x(),1000)
</script>
</head>
<body>
<div id=xx></div>
http://www.vevb.com
</body>
</html>
Can a warning pop up when the time is up and click to enter another screen?
<script>
var lefttime=3 //session time transfer
var tid
function x()
{
lefttime--
document.all.xx.innerText=Remaining:+lefttime + seconds
if(lefttime==0)
{
window.clearInterval(tid);
if(window.confirm(Do you want to enter?))
window.open(http://www.vevb.com/)
}
}
tid = window.setInterval(x(),1000)
</script>
<body>
<div id=xx></div>
Do not use window.open to open another page, but open a new page on the original page.
Change window.open(http://www.vevb.com/) to
window.locaton.href=http://www.vevb.com will do