如何在退出一个页面时自动清空session变量
第一步、在<head></head>间加入
<script language="javascript">
function loginout(){
var gt = unescape('%3e');
var popup = null;
var over = "Launch Pop-up Navigator";
popup = window.open('', 'popupnav',
'width=225,height=235,resizable=1,scrollbars=auto');
if (popup != null) {
if (popup.opener == null) {
popup.opener = self;
}
popup.location.href = 'loginout.asp';
}
}
</script>
第二步、<body>改为<body onUnload="loginout()">
第三步:在loginout.asp中加入如下代码(注意两个文件要在同一目录下)
<%session.abandon%>
<script language="JavaScript">
function closeit() {
setTimeout("self.close()",10000)
}
</script>
本文地址:http://com.8s8s.com/it/it31342.htm