




已阅读5页,还剩13页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
用ASP对象application实现聊天室的源码ASP聊天室源码,此ASP聊天室源码是由ASP的内置对象application实现,简单易懂,供正在学习ASP的友友们一起学习,一起成长!这只是ASP聊天实现的一个过程,所以页面没有做多少设计,懂得设计的友友们如果觉得页面不美观,可以自己设计。这个ASP源码有一不足之处就是私聊对话是分开窗口的,如第二个截图所示。但是在这里我也就不多改动了,友友们可以自己研究一下,这样才会有进步。当然,如果你发现了还有不足,可以联系我,我们一起交流,共同进步!使用方法:这个ASP聊天室源码有12个文件,只需按提示建立好各个文件即可!截图一:截图二:!-index.asp-HTMLHEADMETA HTTP-EQUIV=Pragma CONTENT=no-cacheMETA HTTP-EQUIV=Cache-Control CONTENT=no-cacheMETA HTTP-EQUIV=Expires CONTENT=0/HEADbody style=background:URL(index.jpg) 0 0px repeat-x #f1f1f1; Language=VBScript link rel=stylesheet type=text/css href=style.cssResponse.Buffer=true 设置输出缓存,用于显示不同页面。On error resume next 忽略程序出错部分If Request.ServerVariables(Request_Method)=GET then 判断客户是以什么方式请求 WEB 页面- 客户登陆界面 -centerfont size=5 color=red 欢迎来到聊天室!/font!-登录-form name=MyForm method=POST action=enter.asp target=loginpb昵称/b:input type=text name=nick size=12 style=background-color: rgb(192,192,192);height:20px;b密码/b:input type=password name=nickpsw size=12 style=background-color: rgb(192,192,192);height:20px;input type=submit value= 进入聊天室 name=B1 style=color: rgb(255,255,0); font-size: 9pt; background-color: rgb(0,128,128); width:80px;height:22px; 第一次来?3秒钟a href=# onclick=javascript:regForm();注册/a一下吧!pinput type=hidden name=log size=20 value=1br/p/formp请输入您的个性昵称!然后进入聊天室!/piframe name=regframe border=0 width=0 height=0 src=iframe.html/iframe/centeriframe name=login border=0 width=0 height=0 src=iframe.html/iframediv id=reg style=position:absolute;width:380px;height:40px;border:solid 0px red;display:none;!-注册-form name=MyForm method=POST action=reg.asp target=loginpb昵称/b:input type=text name=reg_nick size=12 style=background-color: rgb(192,192,192);height:20px;b密码/b:input type=password name=reg_nickpsw size=12 style=background-color: rgb(192,192,192);height:20px;input type=submit value= 注 册 name=B_reg style=color: rgb(255,255,0); font-size: 9pt; background-color: rgb(0,128,128); width:60px;height:22px;/form/divscriptfunction regForm()x=event.clientXy=event.clientYdocument.getElementById(reg).style.display=document.getElementById(reg).style.left=x+10;document.getElementById(reg).style.top=y+10;/alert(X coords: + x + , Y coords: + y)/scriptdiv id=ad style=position:absolute;border:solid 0px red;width:100%;height:50%;z-index:100;background:#f1f1f1;/divResponse.End 结束程序的处理End If/body/html!-MyChat.asp-htmlHEADMETA HTTP-EQUIV=Pragma CONTENT=no-cacheMETA HTTP-EQUIV=Cache-Control CONTENT=no-cacheMETA HTTP-EQUIV=Expires CONTENT=0/HEADResponse.clear 清空缓存中的内容Response.Buffer=true 设置输出缓存,用于显示不同页面。On error resume next 忽略程序出错部分Response.Expires=0dim talkApplication(vistor)=0If Request(nick) thenApplication.lock 判断客户是是否在聊天界面中 Session(nick)=Request(nick)Application(vistor)=Application(vistor)+1Application.unlockResponse.Write Application(Session(nick)End Ifframeset rows=70%,* frameborder=no frameset cols=70%,* frameborder=no frame name=show src=show.asp?myName= =Request(nick) noresize scrolling=noframe name=secret_show src=secret_show.asp noresize/framesetframeset rows=50%,*frame name=say src=say.asp scrolling=no noresizeframe name=talkTo src=talkTo.asp scrolling=no noresize/frameset/framesetnoframes/noframes/html!-show.asp-meta http-equiv=refresh content=5系统自动更新brbrFor i=1 to Application.Contents.Count Response.Write 目前有font color=red & Application.Contents.Count & /font人在线! Response.Write Application(vistor)Nextlink rel=stylesheet type=text/css href=style.cssbody style=background:#f1f1f1;If Request(toWhom) = 所有人 OR Request(toWhom) = ThenIf trim(Request.Form(talk) thentalk=trim(Request.Form(talk) 去掉字符后的空格 Application.lockApplication(show)=time&brtable border=0 cellpadding=0 cellspacing=0 width=100% trtd width=100% bgcolor=#C0C0C0/td/trtrtd width=100%font color=#0000FFfont color=reda href=# onclick=javascript:top.say.document.getElementById(toWhom).value=this.innerHTML title=点击私聊&Session(nick)&/a/font 说:/font&talk&/td/trtrtd width=100% bgcolor=#C0C0C0/td/tr/tablebr&Application(show)Application.UnLockResponse.Write Application(show)ElseApplication.lockApplication(show)=Application(show)Application.UnLockResponse.Write Application(show)End IfResponse.Write Application(show)ElseResponse.Write Application(show)End If=私聊=If Request(toWhom) 所有人 And Request(toWhom) Then If Request(toWhom)Session(nick) Then If trim(Request.Form(talk) then stalk=trim(Request.Form(talk)存储悄悄话,我对人说的话 Application(Session(nick)&toWhom)=time&brtable border=0 cellpadding=0 cellspacing=0 width=100% trtd width=100% bgcolor=#C0C0C0/td/trtrtd width=100%font color=#0000FFfont color=red我悄悄地对&Request(toWhom)& 说:/font&stalk&/font/td/trtrtd width=100% bgcolor=#C0C0C0/td/tr/tablebr&Application(Request(toWhom) Application(to&Session(nick)=Application(Session(nick)&toWhom)scriptwindow.top.talkTo.location.href=talkTo.asp;/script End IfIf trim(Request.Form(talk) thenstalk=trim(Request.Form(talk) 去掉字符后的空格 nickObject=Request(TalkTo)Application.lock 存储悄悄话,别人对我说的话Application(Request(toWhom)=time&brtable border=0 cellpadding=0 cellspacing=0 width=100% trtd width=100% bgcolor=#C0C0C0/td/trtrtd width=100%font color=#0000FFfont color=reda href=# onclick=javascript:top.say.document.getElementById(toWhom).value=this.innerHTML title=点击私聊&Session(nick)&/a悄悄地对我 说:/font&stalk&/font/td/trtrtd width=100% bgcolor=#C0C0C0/td/tr/tablebr&Application(Request(toWhom)Application.UnLockResponse.Write Application(Session(nick)&Request(toWhom)ElseApplication.lockApplication(Request(toWhom)=Application(Request(toWhom)Application.UnLockResponse.WriteApplication(Session(nick)&talkToWhom)End If Else scriptwindow.alert(咦,抓到个自言自语的人!);/script End IfEnd Ifscript language=javascript/setTimeout(location.href=show.asp,10000)/script!-say.asp-客户聊天界面 -!-#include file=out.asp- link rel=stylesheet type=text/css href=style.cssbody style=background:URL(index.jpg) 0 -8px repeat-x #f1f1f1;form method=POST action=show.asp name=form1 target=show pbfont color=blue=Session(nick)/font/b对 input type=text name=toWhom id=toWhom value=所有人 style=width:60px;height:20px; 说:input type=text name=talk style=width:50%;height:20px; input type=submit value= 说话 name=B1!-input type=reset value= 取消 name=B2-/pinput type=hidden name=log value=1/form/body!-secret_show.asp-meta http-equiv=refresh content=5系统自动更新brbrlink rel=stylesheet type=text/css href=style.cssbody style=background:#f1f1f1;Response.Write Application(Session(nick) & , & Application(Session(nick)!-talkTo.asp-link rel=stylesheet type=text/css href=style.cssResponse.Write Application(Session(nick)&toWhom)body style=background:#f1f1f1;pcenter为了实时看到信息,每5秒钟会自动刷新一次,您也可以手动刷新!br!-a href=# onclick=logout()退出/a-/center/p!-enter.asp-!-#include file=conn.asp-If Request(nick) And Request(nickpsw) thenSet rs=Server.CreateObject(ADODB.RecordSet)rs.CursorLocation=3sql=Select * from chat where c_name= & Request(nick) & rs.open sql,connIf Not rs.EOF OR Not rs.BOF ThenIf Request(nickpsw) = rs(c_psw) Thenrs.closescript language=javascripttop.location.href=MyChat.asp?nick= =Request(nick) /scriptElsescript language=javascriptalert(密码错误!);/location.href=index.asp/scriptEnd IfElsescript language=javascriptalert(找不到用户!);/scriptEnd IfElsescript language=javascriptalert(昵称或密码不能为空!);/scriptEnd If!-reg.asp-!-#include file=conn.asp-body style=background:#f1f1f1;If Request(reg_nick) And Request(reg_nickpsw) thenSet rs=Server.CreateObject(ADODB.RecordSet)rs.CursorLocation=3sql=Select * from chat where c_name= & Request(reg_nick) & rs.open sql,connIf Not rs.EOF OR Not rs.BOF Thenscript language=javascriptalert(昵称已存在,请重新输入!);/location.href=index.asp/scriptElsers.closesql=Insert
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- FMS课件教学课件
- 信息流账户优化知识培训课件
- 信息技术培训知识课件
- 八年级生物上册 第六单元 第二章 认识生物的多样性说课稿 (新版)新人教版
- 2024年五年级数学下册 6 圆 圆的周长(1)说课稿 苏教版
- 2025年安全员考试题库及答案
- 信号集中监测系统课件
- ESD术课件教学课件
- ERP知识培训内容课件
- 第二课 时间是个魔术师说课稿小学心理健康六年级上册辽大版
- 防水工程质量保证书
- 大额资金使用管理办法
- 业务激励方案61170
- 家电行业售后维修服务管理流程
- 迈克尔杰克逊课件
- 2024年煤炭工业矿井设计规范
- 替莫唑胺耐药机制-深度研究
- 二级中医医院评审专家手册
- 遗产继承案例分析题单选题100道及答案
- DB43∕T 925-2014 保障性苗圃建设规范
- 绿色施工实施策划方案
评论
0/150
提交评论