📄 input.jsp
字号:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="chat.css">
<script language="JavaScript">
function checkForm() {
if (document.chatForm.usermessage.value == "") {
alert("发言不能为空!");
document.chatForm.usermessage.focus();
return false;
}
else {
document.chatForm.usermessage.focus();
return true;
}
}
function userLogout() {
top.window.location="logout.jsp?logout=yes";
}
function openWindow(url) {
var newWin = window.open(url,"","toolbar=no,status=no,scrollbars=yes,menubar=no,width=450,height=320");
return false;
}
</script>
</HEAD>
<BODY bgcolor="#0D85A6" topmargin="10">
<FORM name="chatForm" method="post">
<table border="0" width="100%" align="center" cellspacing="0" cellpadding="0">
<tr valign="top"><td>
<%
String first = (String)request.getParameter("first");
String talkMessage=(String)request.getParameter("content");
String action = (String)request.getParameter("action");
String fontcolor = (String) request.getParameter("fontcolor");
String talkwith =(String)request.getParameter("talkwith");
String systemSpeak=(String) request.getParameter("systemSpeak");
//
String experience = (String) session.getValue("experience");
String userlevel = (String) session.getValue("userlevel");
if (experience == null) experience = "0";
if (userlevel == null) userlevel = "过客";
String Name=(String)session.getValue("Name");
out.println("【<font color='#0000ff'>"+Name+"</font>】"+"对");
//用户第一次进入,初始化状态
if (first == null) {
talkMessage="系统公告:<font color = blue>"+Name+"</font>进入了在线答疑系统,大家欢迎!";
action = "no";
fontcolor = "#000000";
systemSpeak = "yes";
}
if(talkwith==null) {
talkwith = "所有人";
}
%>
<input type="text" name="talkwith" value= <%= talkwith %> >
<input type="hidden" name="first" value="first">
<input type="hidden" name="systemSpeak" value="no">
<%
String aloneTalk=request.getParameter("alonetalk");
if(aloneTalk==null)
aloneTalk="no";
if(aloneTalk.equals("no"))
out.print("<input type=\"checkbox\" name=\"alonetalk\" value=\"yes\" > 悄悄话 ");
else
out.print("<input type=\"checkbox\" name=\"alonetalk\" value=\"yes\" checked > 悄悄话");
%>
<a href="chathelp.htm" onclick="return openWindow(this.href);">答疑帮助</a> <br>
<textarea name="content" cols="50"rows="6"id="content" style="font-size:9pt"></textarea>
<select name="fontcolor" size="1" style="font-size:9pt">
<option style="COLOR: #000000" value="#000000" <% if(fontcolor.equals("#000000")) out.print("selected"); %>>黑色
<option style="COLOR: #7ec0ee" value="#7ec0ee" <% if(fontcolor.equals("#7ec0ee")) out.print("selected"); %>>淡蓝
<option style="COLOR: #0088ff" value="#0088ff" <% if(fontcolor.equals("#0088ff")) out.print("selected"); %>>海蓝
<option style="COLOR: #0000ff" value="#0000ff" <% if(fontcolor.equals("#0000ff")) out.print("selected"); %>>草蓝
<option style="COLOR: #000088" value="#000088" <% if(fontcolor.equals("#000088")) out.print("selected"); %>>深蓝
<option style="COLOR: #8800ff" value="#8800ff" <% if(fontcolor.equals("#8800ff")) out.print("selected"); %>>蓝紫
<option style="COLOR: #ab82ff" value="#AB82FF" <% if(fontcolor.equals("#AB82FF")) out.print("selected"); %>>紫色
<option style="COLOR: #ff88ff" value="#ff88ff" <% if(fontcolor.equals("#ff88ff")) out.print("selected"); %>>紫金
<option style="COLOR: #ff00ff" value="#ff00ff" <% if(fontcolor.equals("#ff00ff")) out.print("selected"); %>>红紫
<option style="COLOR: #ff0088" value="#ff0088" <% if(fontcolor.equals("#ff0088")) out.print("selected"); %>>玫红
<option style="COLOR: #ff0000" value="#ff0000" <% if(fontcolor.equals("#ff0000")) out.print("selected"); %>>大红
<option style="COLOR: #f4a460" value="#f4a460" <% if(fontcolor.equals("#f4a460")) out.print("selected"); %>>棕色
<option style="COLOR: #888800" value="#888800" <% if(fontcolor.equals("#888800")) out.print("selected"); %>>卡其
<option style="COLOR: #888888" value="#888888" <% if(fontcolor.equals("#888888")) out.print("selected"); %>>铁灰
<option style="COLOR: #90e090" value="#90E090" <% if(fontcolor.equals("#90E090")) out.print("selected"); %>>绿色
<option style="COLOR: #008800" value="#008800" <% if(fontcolor.equals("#008800")) out.print("selected"); %>>橄榄
<option style="COLOR: #008888" value="#008888" <% if(fontcolor.equals("#008888")) out.print("selected"); %>>灰蓝
</select>
<input type="submit" name="Submit" value="发送" style="font-size:9pt" onclick="return checkForm();">
<input type="button" name="logout" value="离开" style="font-size:9pt" onclick="return userLogout();">
</td>
</tr>
</table>
<%
String action2 = "";
int i = action.indexOf("B");
if (i != -1) {
action = action.substring(0,i) + "<font color='blue'>" + talkwith + "</font>" + action.substring(i+1);
}
if(!action.equals("no")) {
talkMessage = action + "<font color=" + fontcolor + ">" + talkMessage + "</font>";
action2 = "yes";
}
else if (first != null) {
talkMessage = "<font color = " + fontcolor + ">" + talkMessage + "</font>";
action2 = "no";
}
String online = (String) session.getValue("online");
if (online == null) {
online = "";
}
if (online.equals("no")) {
out.print("<script>alert(\"你已经被踢出,不要再捣乱啦!\");</script>");
return;
}
if (Name == null) {
return;
}
Vector Message = null;
synchronized (application) {
Message= (Vector)application.getAttribute("Message");
if(Message==null) {
Message= new Vector(30,10);
}
if(Message.size()>200) {
Message.removeAllElements();
}
Message.addElement(aloneTalk);
Message.addElement(Name);
Message.addElement(talkwith);
Message.addElement(talkMessage);
Message.addElement(systemSpeak);
Message.addElement(action2);
application.setAttribute("Message", Message);
}
%>
</FORM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -