To determine the expiration time of the session using JavaScript real-time display how many seconds _ Application tips

Source: Internet
Author: User
Tags setinterval
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%session.timeout=1440 ' unit (minutes) 1440 = 24-hour parameter cannot be greater than 24 hours or greater than 1440 minutes%>
<%
If session ("login") <> "888888" then ' to determine 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 ">
<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);d ocument.all.xx.innertext= "Login timed Out"}
}
Tid = Window.setinterval ("x ()", 1000)
</script>
<body>
<div id=xx></div>
Http://www.jb51.net
</body>
Can you pop a warning when it's time to click and then 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 ("You want to enter?"))
window.open ("http://www.jb51.net/")
}
}
Tid = Window.setinterval ("x ()", 1000)
</script>
<body>
<div id=xx></div>
Don't window.open open another page, open a new page on the original page.
Convert window.open ("http://www.jb51.net/") to
Window.locaton.href= "Http://www.jb51.net" is fine.
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.