Determine the expiration time of the session using JavaScript to display the remaining seconds in real time
Source: Internet
Author: User
<% @ Language = "VBScript" codePage = "936" %>
<% Session. Timeout = 1440 'Unit (minute) 1440 = 24 hours parameter cannot be greater than 24 hours, that is, cannot be greater than 1440 minutes %>
<%
If SESSION ("login") <> "888888" then' determines whether the session is valid
Response. Write ("session 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 = "Logon timeout "}
}
Tid = Window. setinterval ("X ()", 1000)
</SCRIPT>
</Head>
<Body>
<Div id = XX> </div>
Http://www.jb51.net
</Body>
</Html>
Can I bring up a warning when the time is reached and click it to go to 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.jb51.net /")
}
}
Tid = Window. setinterval ("X ()", 1000)
</SCRIPT>
<Body>
<Div id = XX> </div>
Do not open window. Open another page. Open a new page on the original page.
Change window. Open ("http://www.jb51.net/")
Window. locaton. href = "http://www.jb51.net ".
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.