<HTML>
<BODY bgcolor="rgb(230,300,100)">
<%
name=Session("curruser")
'如果用户选择退出，则将其姓名和谈话内容清除
If Request.Form("Quit")="退出" Then
   If name<>"" then   
      Application.unlock
      Application("people")=Replace(Application("people"), name&",","") 
      Application(name)=""
      Items=split(application("people"),",")
      str=name & "离开了<BR>" 
      For i=0 To ubound(items)-1
          Application(items(i))=str&application(items(i))
      Next
      Application.unlock
      Session.abandon
   End If
Else
   If Request.Form("content")<>"" then
       '构造显示信息
    str="<FONT color='"&Request.Form("color")&"'>"&name&Request.Form("face")
&"说:" & Server.HtmlEncode(Request.Form("content"))&"</FONT><BR>"
       '发送显示信息
       Items=split(application("people"),",")
       who=Request.Form("who")
       Application.Lock
       '如果聊天对象为所有人
       If Request.Form("who")="all" Then
       '为每个用户设置聊天内容
          For i=0 To ubound(items)-1
              Application(items(i))=str&application(items(i))
          Next
       '如果聊天对象为某个用户
       Else
          For i=0 To ubound(items)-1
              If items(i)=name or items(i)=who then
             '设置聊天内容
                 Application(items(i))=str&Application(items(i))
               End if
          Next
       End if
       Application.Unlock
   End if
%>
<%'没有指定action属性值，表示调用自身%>
    <Form method="post" action="">
    <P>字体颜色 
    <Select name="color" size=1>
           <Option value="blue">蓝色</Option>
           <Option value="yellow">黄色</Option>
           <Option value="green">绿色</Option>
           <Option value="red">红色</Option>
           <Option value="gray">灰色</Option>
           <Option value="black">黑色</Option>
           <Option value="white">白色</Option>
    </Select>
    选择谈话表情   
    <Select name="face" size=1>
            <Option value="神采奕奕地">神采奕奕地</Option>
            <Option value="无聊搭闲地">无聊搭闲地</Option>
            <Option value="兴高采烈地">兴高采烈地</Option>
            <Option value="悲哀忧伤地">悲哀忧伤地</Option>
            <Option value="无限深情地">无限深情地</Option>
            <Option value="笑逐颜开地">笑逐颜开地</Option>
            <Option value="愤怒谴责地">愤怒谴责地</Option>
    </Select>
    选择聊天对象   
    <Select name="who" size=1>
            <Option value="all">全体成员</option>
            <%'添充目前在线的用户名
            Items=split(Application("people"),",")
            For i=0 To ubound(items)-1
            %>
               <Option value="<%=items(i)%>"><%=items(i)%></Option>
            <%next%>
            </Select></P>
   <P><%'聊天内容输入%>
   <INPUT type="text" name="content" size="50"> 
   <INPUT type="submit" name="Quit" value="提交"> 
   <INPUT type="submit" name="Quit" value="退出"></P>
<%End if%>   
</BODY>
</HTML>
