?? logout.jsp
字號:
<%@ page contentType="text/html; charset=GB2312"
import="java.util.Date"%>
<%
String User = (String) session.getAttribute("User");
//從session對象中取得名為User的對象
//判斷是否為空值, 是則代表用戶尚未完成登錄
//則不進行歡送信息的新增
if(User != null)
{
String Msg = null;
//下面的for循環將把每個信息向后移動
for(int i = 40; i >= 2; i--)
{
Msg = (String)application.getAttribute("Msg" + (i - 1));
application.setAttribute("Msg" + i, Msg);
}
Date Now = new Date(); //取得目前的系統時間
String year = String.valueOf(Now.getYear() + 1900);
String month = String.valueOf(Now.getMonth() + 1);
String day = String.valueOf(Now.getDate());
String hour = String.valueOf(Now.getHours());
String minute = String.valueOf(Now.getMinutes());
String second = String.valueOf(Now.getSeconds());
String time = year + "/" + month + "/" + day + " "
+ hour + ":" + minute + ":" + second;
//取得目前的日期與時間
String Sex = (String) session.getAttribute("Sex");
//依照不同姓別設置歡送詞
if(Sex.equals("F"))
{
Msg = "<TR><TH Colspan = 4 BGColor=Pink align=left>"
+ "<Font Color = Yellow>恭送<Font Color = Red>"
+ User + "美女</FONT>于<Font Color = Green>[" +
time + "]</Font>離開</TH>";
}
else
{
Msg = "<TR><TH Colspan = 4 BGColor=Silver align=left>"
+ "<Font Color = Yellow>恭送<Font Color = Blue>"
+ User + "帥哥</FONT>于<Font Color = Green>[" +
time + "]</Font>離開</TH>";
}
application.setAttribute("Msg1", Msg);
//將恭送詞存入application對象
String strNum = (String) application.getAttribute("LogNum");
//取得保存于application的LogNum資料, 此資料為目前的登錄人數
int LogNum = Integer.parseInt(strNum);
//取得登錄人數
application.setAttribute("LogNum", String.valueOf(LogNum - 1));
//將登錄人數減1后更新
}
%>
<HTML>
<HEAD>
<TITLE>聊天室</TITLE>
<Script Language = "javascript">
<!--
function window_onload()
{
top.close(); //關閉窗口
}
-->
</Script>
</HEAD>
<BODY onload="window_onload()"></BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -