判斷Session的過(guò)期時(shí)間 采用JavaScript實(shí)時(shí)顯示剩余多少秒
更新時(shí)間:2008年12月29日 16:59:15 作者:
判斷Session的過(guò)期時(shí)間-采用JavaScript顯示剩余多少秒
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%session.timeout=1440 '單位(分鐘)1440=24小時(shí) 參數(shù)不能大于24小時(shí) 也就是不能大于1440分鐘%>
<%
if session("login")<>"888888" then'判斷Session是否有效
Response.Write("Session過(guò)期了")
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>無(wú)標(biāo)題文檔</title>
<script>
var lefttime=6 //session時(shí)間傳遞
var tid
function x()
{
lefttime--
document.all.xx.innerText="剩余:"+lefttime + "秒"
if(lefttime==0) {clearInterval(tid);document.all.xx.innerText="登錄超時(shí)了" }
}
tid = window.setInterval("x()",1000)
</script>
</head>
<body>
<div id=xx></div>
http://www.dbjr.com.cn
</body>
</html>
能不能在時(shí)間到的時(shí)候彈出一個(gè)警告,點(diǎn)擊之后進(jìn)入另一畫(huà)面?
<script>
var lefttime=3 //session時(shí)間傳遞
var tid
function x()
{
lefttime--
document.all.xx.innerText="剩余:"+lefttime + "秒"
if(lefttime==0)
{
window.clearInterval(tid);
if(window.confirm("您要進(jìn)入嗎?"))
window.open("http://www.dbjr.com.cn/")
}
}
tid = window.setInterval("x()",1000)
</script>
<body>
<div id=xx></div>
不要window.open打開(kāi)另一個(gè)頁(yè)面,要在原來(lái)的那個(gè)頁(yè)面上打開(kāi)新的頁(yè)面。
將window.open("http://www.dbjr.com.cn/")改成
window.locaton.href="http://www.dbjr.com.cn"就行了
<%session.timeout=1440 '單位(分鐘)1440=24小時(shí) 參數(shù)不能大于24小時(shí) 也就是不能大于1440分鐘%>
<%
if session("login")<>"888888" then'判斷Session是否有效
Response.Write("Session過(guò)期了")
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>無(wú)標(biāo)題文檔</title>
<script>
var lefttime=6 //session時(shí)間傳遞
var tid
function x()
{
lefttime--
document.all.xx.innerText="剩余:"+lefttime + "秒"
if(lefttime==0) {clearInterval(tid);document.all.xx.innerText="登錄超時(shí)了" }
}
tid = window.setInterval("x()",1000)
</script>
</head>
<body>
<div id=xx></div>
http://www.dbjr.com.cn
</body>
</html>
能不能在時(shí)間到的時(shí)候彈出一個(gè)警告,點(diǎn)擊之后進(jìn)入另一畫(huà)面?
<script>
var lefttime=3 //session時(shí)間傳遞
var tid
function x()
{
lefttime--
document.all.xx.innerText="剩余:"+lefttime + "秒"
if(lefttime==0)
{
window.clearInterval(tid);
if(window.confirm("您要進(jìn)入嗎?"))
window.open("http://www.dbjr.com.cn/")
}
}
tid = window.setInterval("x()",1000)
</script>
<body>
<div id=xx></div>
不要window.open打開(kāi)另一個(gè)頁(yè)面,要在原來(lái)的那個(gè)頁(yè)面上打開(kāi)新的頁(yè)面。
將window.open("http://www.dbjr.com.cn/")改成
window.locaton.href="http://www.dbjr.com.cn"就行了
您可能感興趣的文章:
- js實(shí)時(shí)獲取并顯示當(dāng)前時(shí)間的方法
- jsp實(shí)現(xiàn)頁(yè)面實(shí)時(shí)顯示當(dāng)前系統(tǒng)時(shí)間的方法
- 比較簡(jiǎn)潔的JavaScript 實(shí)時(shí)顯示時(shí)間的腳本 修正版
- javascript實(shí)時(shí)顯示北京時(shí)間的方法
- 詳解js實(shí)時(shí)獲取并顯示當(dāng)前時(shí)間的方法
- 基于JS代碼實(shí)現(xiàn)實(shí)時(shí)顯示系統(tǒng)時(shí)間
- js實(shí)時(shí)獲取系統(tǒng)當(dāng)前時(shí)間實(shí)例代碼
- 頁(yè)面實(shí)時(shí)更新時(shí)間的JS實(shí)例代碼
- JS使用Date對(duì)象實(shí)時(shí)顯示當(dāng)前系統(tǒng)時(shí)間簡(jiǎn)單示例
- 使用Javascript在HTML中顯示實(shí)時(shí)時(shí)間
相關(guān)文章
Access模糊查詢(xún)查不到數(shù)據(jù)的解決方法
由于Access中的模糊查詢(xún)語(yǔ)句 like 里的通配符不是%而是*,所以要注意一下2008-06-06ASP模擬POST請(qǐng)求異步提交數(shù)據(jù)的方法
這篇文章主要介紹了ASP模擬POST請(qǐng)求異步提交數(shù)據(jù)的方法,本文使用MSXML2.SERVERXMLHTTP.3.0實(shí)現(xiàn)POST請(qǐng)求,需要的朋友可以參考下2014-07-07ASP 日期的加減運(yùn)算實(shí)現(xiàn)代碼
今天在工作中遇到了一個(gè)問(wèn)題,需要按時(shí)間查詢(xún),可是查詢(xún)出來(lái)的結(jié)果顯示的不正確。2009-12-12ASP 連接Access數(shù)據(jù)庫(kù)的登陸系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了ASP 連接Access數(shù)據(jù)庫(kù)的登陸系統(tǒng),感興趣的小伙伴們可以參考一下2016-07-07捕捉并保存ASP運(yùn)行錯(cuò)誤的函數(shù)代碼
捕捉并保存ASP運(yùn)行錯(cuò)誤的函數(shù)代碼,需要獲取asp代碼運(yùn)行錯(cuò)誤的朋友可以參考下2012-03-03