網(wǎng)站建設(shè)之最簡(jiǎn)單的聊天室程序
想到聊天室,你一定會(huì)認(rèn)為非常復(fù)雜非常麻煩的吧,呵呵,這僅僅只有一段簡(jiǎn)單的ASP代碼,實(shí)現(xiàn)了聊天室的基本功能,不妨參考下:將以下代碼保存為liaotian.asp
<%If Request.ServerVariables("Request_Method")="GET" then%>
<form method="post" action="liaotian.asp">
<input type="text" name="nick" Value="您的昵稱(chēng)"><p>
<input type="submit" Value="come in"><p>
<input type="hidden" name="log" size="20" Value="1">
</form>
<%Response.End
Else
Response.clear
dim talk
If Request.Form("nick")<>"" then
Session("nick")=Request.Form("nick")
End if
%>
<form method="post" action="liaotian.asp" name=form1>
<%=Session("nick")%>說(shuō)話(huà):
<input type="text" name="talk" size="50"><br>
<input type="submit" Value="提交">
<input type="reset" Value="取消"></p>
</form>
<a href="liaotian.asp">離開(kāi)</a><br>
<%
If Request.Form("log")<>1 then
If trim(Request.Form("talk"))="" then
talk=Session("nick")&"不說(shuō)一句話(huà)就想來(lái)敷衍大家"
Else
talk=trim(Request.Form("talk"))
End If
Application.lock
Application("show")="來(lái)自"&Request.ServerVariables("remote_addr")& "的" &Session("nick")&"在"&time& "的時(shí)候說(shuō):" &talk& "<br>" &Application("show")
Application.UnLock
Response.Write Application("show")
End if
%>
<%End if%>
提示:將V改成v