个简单的聊天室示例,代码如下: <HTML> <HEAD> <META NAME=GENERATOR" Content= Microsoft Visual Studio 6.07> BODY BGCOLOR=#CODOD9> Response Buffer=true If Request Server Variables("Request Method=GET"' ther <FORM METHOD=""POST"ACTION="chat lasp"><P> <H3>请输入你的昵称</H3> <INPUT TYPE=TEXT NAME=nick" vaLUe="> <Ⅰ NPUT TYPE= SUBMIT NAME=B1 VALUE=进入” <P> <INPUT TYPE= HIDDEN NAME=log?" VAlUe=1"> <FORM> Response. End Response. clear Response. Write("<BODY BGCOLOR=#COD9D9>) Dim talk If Request Form("nick")then End lf <FORM METHOD="POST"ACTION="chatl asp <P> <H3><%= Session(nick)%消息:<H3> < INPUT TYPE= TEXT NAME=tak”SIZE=50”> < NPUTTYPE= SUBMIT VALUE=“提交”NAME=B1” < INPUT TYPE= RESET VALUE=取消”NAME=B2”> < A HREF= chat. asp”>返回</A
一个简单的聊天室示例,代码如下: <%@ Language=VBScript %> <HTML> <HEAD> <META NAME=“GENERATOR” Content=“Microsoft Visual Studio 6.0”> </HEAD> <BODY BGCOLOR=#COD9D9> <% Response.Buffer=true On error resume next If Request.ServerVariables(“Request_Method”)=“GET” then %> <FORM METHOD=“POST” ACTION=“chat1.asp”><P> <H3>请输入你的昵称</H3> <INPUT TYPE=“TEXT” NAME=“nick” VALUE=““> <P> <INPUT TYPE=“SUBMIT” NAME=“B1” VALUE=“进入”> <P> <INPUT TYPE=“HIDDEN” NAME=“log” VALUE=“1”> </FORM> <% Response.End Else Response.clear Response.Write(“<BODY BGCOLOR=#COD9D9>“) Dim talk If Request.Form(“nick”)<>““ then Session(“nick”)=Request.Form(“nick”) End If %> <FORM METHOD=“POST” ACTION=“chat1.asp”> <P> <H3><%=Session(“nick”)%> 消息:</H3> <INPUT TYPE=“TEXT” NAME=“talk” SIZE=“50”> <P> <INPUT TYPE=“SUBMIT” VALUE=“提交” NAME=“B1”> <INPUT TYPE=“RESET” VALUE=“取消” NAME=“B2”> </FORM> <A HREF=“chat1.asp”> 返回 </A> <P>
If Request Form("log)l then If TRIM(Request Form("talk))=then tak= Session(“nick)&沉默是金 Else talk=TRIM(Request Form("talk")) End If Application lock Application("show)=<table border=o' cellpadding=0 cellspacing=0 width=85%> <tr><td width=100%' bgcolor='#CoCoCo,></td><tr><tr><td width=100%><font color- 00oF>来自“& Request. Server variable( remote addr”)k”的“& Session(“nick")& time&”说:<font>“&tlk&”</td</r><tr>< <td width=100% bgcolor=# COCCO></d> <t></ table><br>“& Application(“show”) Application. Unlock Response. Write Application(show) End If End lf <BODY> <HTML>
<% If Request.Form(“log”)<>1 then If TRIM(Request.Form(“talk”))=““ then talk=Session(“nick”)&”沉默是金。” Else talk=TRIM(Request.Form(“talk”)) End If Application.lock Application(“show”)=“<table border='0' cellpadding='0' cellspacing='0' width='85%'> <tr><td width='100%' bgcolor='#C0C0C0'></td></tr><tr><td width='100%'><font color= '#0000FF'> 来自 “&Request.ServerVariables(“remote_addr”)&” 的 “&Session(“nick”)& time&” 说:</font> “&talk&”</td></tr><tr><td width='100%'bgcolor='#C0C0C0'></td> </tr></table><br>“&Application(“show”) Application.Unlock Response.Write Application(“show”) End If End If %> </BODY> </HTML>