爱若琴弦聊天室中有个"即时消息",有人知道其中的原理吗?(急)

liuping00 2003-12-20 10:47:32
代码看得不怎么明白?有人知道吗?

下面是显示与发送页的代码
<%
Response.Expires=0
Response.ExpiresAbsolute=Now()-1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
Dim nowline,newline
If not IsArray(Session("info")) Then
Response.Write "<script language='javascript'>top.location.href='err.asp?kind=20';</script>"
Response.End
End If
info = Session("info")
If InStr(Application("maninfo"),"," & info(0) & ",") <> 0 Then Response.Redirect "manyou.asp"
words = Application("zzbird_words")
nowline = info(8)
Response.Write ("<Script Language='JavaScript'>" & _
"parent.timev='" & time & "';")
If InStr(Application("giveyou"),"," & info(0) & ";") <> 0 Then Response.Write "parent.giveyou.location.href='giveyou.asp';"
Response.Write "</Script>"
If nowline = Application("zzbird_line") Then Response.End
Dim show()
Redim Preserve show(0)
j = 1
newline = 0
For i = 1 to 240 step 6
newline = words(i)
If newline > nowline and newline > 0 and not (words(i + 3) = "onlysay" and words(i + 2) <> info(0) and words(i + 1) <> info(0) or words(i + 3) = "callyou" and InStr(words(i + 2),info(0)&"|") <> 1) Then
Redim Preserve show(j + 4)
show(j) = words(i + 1)
show(j + 1) = words(i + 2)
show(j + 2) = words(i + 3)
show(j + 3) = words(i + 4)
show(j + 4) = words(i + 5)
j = j + 5
End If
Next
Response.Write "<Script Language=JavaScript>var myroom = '" & info(6) & "';"
Response.Write "if(window==window.top){top.location.href='chat.asp?fp=1';}if(parent.nowroom!=myroom){parent.nowroom=myroom;}"
For i = 1 to UBound(show) step 5
Response.Write "parent.w(" & chr(34) & show(i) & chr(34) & "," & chr(34) & show(i + 1) & chr(34) & "," & chr(34) & show(i + 2) & chr(34) & "," & chr(34) & show(i + 3) & chr(34) & "," & chr(34) & show(i + 4) & chr(34) & ");" & chr(13) & chr(10)
Next
Response.Write "</Script>"
If newline > nowline Then info(8) = newline
Session("info") = info
%>
...全文
46 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuping00 2003-12-20
  • 打赏
  • 举报
回复
但定时刷新会占很大的系统资源
怎样减少占用服务器的资源呢?
Tal 2003-12-20
  • 打赏
  • 举报
回复
用隐藏帧
jzywh 2003-12-20
  • 打赏
  • 举报
回复
定时刷新的iframe
aspbiz 2003-12-20
  • 打赏
  • 举报
回复

应该是聊天室的改造吧,很简单的。
liuping00 2003-12-20
  • 打赏
  • 举报
回复
to mrcd()
我种方法比较好,不用经常刷新
但我怎样刷新用户的页面呢?
mrcd 2003-12-20
  • 打赏
  • 举报
回复
把消息登在聊天页上,并把所有在线的用户的页面刷新一次并把聊天内容保存到SQL中!!
nchen123 2003-12-20
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2511/2511639.xml?temp=.9922754

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧