当前位置: 首页 > 图文教程 > 网络编程 > ASP > 最简单的ASP聊天室(附源码)

ASP
ASP实例代码:搞个长文章分页代码
说说对象的复制
多个函数验证同一表单
查询某个字段没有值的所有记录的SQL语句怎么写?
ASP实例:一个简单的ASP无组件上传类
ASP实例讲解:用分页符实现长文章分页显示
ASP实例:动态网页中常用的6个ASP程序
ASP实例:词语搭配游戏的制作
ASP实例学习:随机生成文件名的函数
asp实例:测试WEB服务器
ASP实例:计数器程序详解
预防ASP网站被黑 彻底了解ASP木马
分享:XML HTTP Request的属性和方法简介
ASP架设:给每个IIS站点建立一个用户
ASP技巧:判断远程图片是否存在
故障解决:解决ASP脚本运行超时的方法
再说ASP输出N行N列表格
怎么判断一个对象是否已被释放
ASP实现网页打开任何类型文件都保存的方法
ASP技巧:利用函数InstrRev()获取当前文件名

最简单的ASP聊天室(附源码)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 27 ::
收藏到网摘: n/a

  <%@ Language=VBScript %>
<%
Response.Buffer=true ' 设 置 输 出 缓 存,用 于 显 示 不 同 页 面。
On error resume next ' 忽 略 程 序 出 错 部 分
If Request.ServerVariables("Request_Method")="GET" then
' 判 断 客 户 是 以 什 么 方 式 请 求 WEB 页 面
'------------------------
' 客 户 登 陆 界 面
'------------------------
%>

<form method="POST" action="http://www.cs02.com/luo40.asp"><p>
<input type="text" name="nick" size="20" value="nick" style="background-color: rgb(192,192,192)"><br>
<input type="submit" value=" 进 入 聊 天 室 " name="B1" style="color: rgb(255,255,0); font-size: 9pt; background-color: rgb(0,128,128)">
<p><input type="hidden" name="log" size="20" value="1"><br></p>
</form>

<%
Response.End ' 结 束 程 序 的 处 理
Else
Response.clear ' 清 空 缓 存 中 的 内 容
dim talk
If Request.Form("nick")<>"" then
' 判 断 客 户 是 是 否 在 聊 天 界 面 中
Session("nick")=Request.Form("nick")
End If
'------------------------
'客 户 聊 天 界 面
'------------------------
%>

<form method="POST" action="http://www.cs02.com/luo40.asp" name=form1> <p><%=Session("nick")%> 说 话:<input type="text" name="talk" size="50"><br>
<input type="submit" value=" 提 交 " name="B1">
<input type="reset" value=" 取 消 " name="B2"></p>
</form>
<A HREF="http://www.cs02.com/luo40.asp"> 离 开 </a><br><br>

<%
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
%>