The previous two sections introduce how to deal with the conversation content in the chat room and the special handling of whispers, so far. Let's see how the conversation is displayed on the client. Please take a look at our display dialogue file ()
*
<% @language="vbscript" %>
<%
=0
'=true
%>
<meta http-equiv="refresh" content="2.5">
<body bgcolor="<%=application("zj_1color")%>" topmargin="0" leftmargin="0">
<I><center><font color="#FFFF00" size=4><%=application("zj_1title")%></font></center></I>
<%
if session("userzj_1")="" then
session("userzj_1")=""
session("zj_1level")=""
session("zj_1start")=""
session("zj_1total")=0
session("zj_1boot")=""
session("zj_1counter")=0
session("zj_1open")=""
'
%>
<script LANGUAGE="javascript">
=""
</script>
<%
end if
'Are you making trouble?
for n=1 to 40
if session("userzj_1")=application("peoplezj_1"&n) then
exit for
end if
if n=40 then
session("zj_1boot")="true"
%>
<script LANGUAGE="javascript">
=""
</script>
<%
end if
next
%>
<script LANGUAGE="javascript">
<%
if session("zj_1counter")<>application("zj_1counter") then
if session("zj_1counter")<application("zj_1counter") then
for I=session("zj_1counter")+1 to application("zj_1counter")
%>
("<%=application("zj_1chats")(I)%>")
<%
next
else
for I=session("zj_1counter") to 20
if application("zj_1counter")<>1 then
%>
("<%=application("zj_1chats")(I)%>")
<%
end if
next
for I=1 to application("zj_1counter")
%>
("<%=application("zj_1chats")(I)%>")
<%
next
end if
if session("zj_1open")="true" then
session("zj_1counter")=application("zj_1counter")
end if
end if
'Announcement
if session("zj_1public")<>application("zj_1public") then
%>
("<%=application("zj_1public")%>")
<%
session("zj_1public")=application("zj_1public")
end if
'Are there any whispers?
if session("zj_1chat")<>application("zj_1chat") then
if application("zj_1owner")=session("userzj_1") or application("zj_1chatto")=session("userzj_1") or application("zj_1chatto")="ALL" then
%>
("<%=application("zj_1chat")%>")
<%
end if
session("zj_1chat")=application("zj_1chat")
end if
application("peoplezj_1_appear"&n)
count=0
for n=1 to 40
if application("peoplezj_1"&n)<>"" then
count=count+1
end if
next
if session("zj_1total")<>count then
session("zj_1total")=count
session("zj_1refresh")="true"
%>
</script>
<%
end if
%>
The chat room has the functions of management (kicking unpopular people out of the chat room, announcement, etc., so Xiaohu, who has nothing to do with speech processing and whispering functions, will not give any explanation.
Previously, we used a public object of application("zj_1counter") to save the buffer element where the latest speech is located. Use session("zj_1counter") to save the dialog elements that the current user itself has displayed. Each time this file is called, just compare the values of session("zj_1counter") and application("zj_1counter") and you can know that you need to display a new conversation. Each time the display is completed, the two count values must be unified. Otherwise, an error will occur in repeatedly displaying the conversation content.
It is also used in a loop in the buffer. For example, the current user's conversation content is stored in application("chats")(18), and the new speech has returned to application("chats")(2). Therefore, four speeches need to be displayed this time, and the detailed explanation of Xiaohu will not do it. Everyone take a closer look. Then think about it, it is easy to understand.
The whisper and public dialogue application("chat")(n) are processed separately, so after the public dialogue is processed, the whisper is processed. The whisper logo is session("chat") (it is used to store the last whisper content. When the application("chat") is compared to the last time, you can know that the whisper needs to be displayed. After the whisper is displayed, don't forget to synchronize session("chat") with application("chat"), otherwise the whisper will keep ringing in your ears, which will be very noisy.
Here I will introduce to you a way to deal with whispers, and there are many ways to make a chat room. Good or bad will affect the performance of the chat room (speed. Fault tolerance, etc.). It is very skillful to make a good chat room. At this point. Xiaohu felt that his chat room was not good. Need to be improved.
The chat room address of this example is: http://active. Welcome to "Su Su Xinyu
Note that the session("zj_1chat") in the program is actually the same variable as the session("chat") in the commentary, and the same is true for application("zj_1chats")(n) and so on. . . Please pay attention to it. Xiaohu won't modify the differences in the program
Previous page1234Next pageRead the full text