以前看到网易上的聊天室,很有意思,就想学学它的实现原理,但就是找不到相关的资料,偶然的一次,在网上看到有人说用隐藏框架来刷新读取数据这样能实现页面不闪烁,但状态栏上的进度条还是有的,这样我就在别的页面建立连接用“open”命令去掉状态栏等来打开聊天室主窗口就可以实现“无刷新”了。下面是下载地址:
以前看到网易上的聊天室,很有意思,就想学学它的实现原理,但就是找不到相关的资料,偶然的一次,在网上看到有人说用隐藏框架来刷新读取数据这样能实现页面不闪烁,但状态栏上的进度条还是有的,这样我就在别的页面建立连接用“open”命令去掉状态栏等来打开聊天室主窗口就可以实现“无刷新”了。下面是下载地址:
纯ASP实现的“无刷新”聊天室下载地址
记住,要用open命令打开就没有状态栏上的进度条(以屏幕分辨率1024*768为例):
window.open("chat_index.asp","chat",width=1000,height=700,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0)
同时也贴上代码吧!


1
<%
2
select case request("action")
3
case "talk"
4
call talk()
5
case "showh"
6
call showh()
7
case "listh"
8
call listh()
9
case "send"
10
call send()
11
case "modify"
12
call modify()
13
case "music"
14
call music()
15
case "exitchat"
16
call exitchat()
17
case else
18
call main()
19
end select
20
21
sub exitchat()
22
if isarray(session("dv_user")) then
23
dv_user=session("dv_user")
24
25
Application.lock
26
Application("onlinelist")=replace(Application("onlinelist"),session("dv_user")(0)&" ","")
27
Application.Unlock
28
29
msgstr="parent.showmsg('1','"&session("dv_user")(0)&"','大家','【系统消息】"&session("dv_user")(0)&"离开了聊天室。。!','AA00CC','0','"&time()&"'); "
30
31
Application.Lock
32
sd=Application("chat_sd")
33
line=int(Application("chat_line"))
34
Application("chat_line")=line+1
35
Dim newsd(50)
36
j=1
37
for i=3 to 50 step 2
38
newsd(j)=sd(i)
39
newsd(j+1)=sd(i+1)
40
j=j+2
41
next
42
newsd(49)=line+1
43
newsd(50)=msgStr
44
Application("chat_sd")=newsd
45
Application.UnLock
46
47
dv_user(1)= Application("chat_line")
48
session("dv_user")=""
49
end if
50
%>
51
<script LANGUAGE="JavaScript">
52
if(window!=window.top){top.location.href=location.href;}
53
window.close();
54
</script>
55
<%
56
end sub
57
58
sub listh()
59
online=Application("onlinelist")
60
online=split(online," ")
61
Response.Write "<script language=javascript>parent.list.document.open();"
62
Response.Write "parent.list.document.writeln('<body bgcolor=#cc99ff bgproperties=fixed >');"
63
Response.Write "parent.list.document.writeln('<style type=text/css>A:visited{TEXT-DECORATION: none;Color:#000000}A:active{TEXT-DECORATION: none;Color:#000000}A:hover{TEXT-DECORATION: underline;Color:#000000}A:link{text-decoration: none;Color:#000000}BODY{FONT-FAMILY: 宋体; FONT-SIZE: 12px;}</style>');"
64
Response.Write "msg='<a href=javascript:parent.setuser(\'大家\'); target=talk>大家</a><br>';parent.list.document.writeln('当前在线("&ubound(online)&")人<br>--------------------');"
65
for i=lbound(online) to ubound(online)-1
66
Response.Write "msg=msg+'<a href=javascript:parent.setuser(\'"&online(i)&"\'); target=talk>"&online(i)&"</a><br>';"
67
next
68
Response.Write "parent.list.document.writeln(msg);"
69
Response.Write "</script>"
70
Response.Write "<script Language=JavaScript>setTimeout('this.location.reload();',7000);</script>"
71
end sub
72
73
sub send()
74
Response.Buffer =true
75
if not isarray(session("dv_user")) then
76
Response.Write "未登陆不能发言!"
77
Response.End
78
end if
79
dv_user=session("dv_user")
80
username=dv_user(0)
81
userline=dv_user(1)
82
sendtime=dv_user(2)
83
send_time=now()
84
85
msgstr=Request.Form ("post_content")
86
towho=Request.Form ("towho")
87
msgcolor=Request.Form ("msgcolor")
88
secret=Request.Form ("secret")
89
if msgcolor="" then Response.End
90
91
if secret<>1 then secret=0
92
93
if Instr(msgstr,"[tu]")<>0 then
94
dim reg
95
set reg=new regexp
96
reg.IgnoreCase=true
97
reg.Global=true
98
reg.Pattern="(tu)([1234567890])(\/tu)"
99
msgstr=reg.Replace(msgstr,"<img src=emot/em$2.gif>")
100
reg.Pattern="(tu1)([1234567890])(\/tu)"
101
msgstr=reg.Replace(msgstr,"<img src=emot/em1$2.gif>")
102
reg.Pattern="(tu2)([1234567890])(\/tu)"
103
msgstr=reg.Replace(msgstr,"<img src=emot/em2$2.gif>")
104
set reg=nothing
105
end if
106
107
msgstr="parent.showmsg('0','"&username&"','"&towho&"','"&msgstr&"','"&msgcolor&"','"&secret&"','"&time()&"');"
108
109
Application.Lock
110
sd=Application("chat_sd")
111
line=int(Application("chat_line"))
112
Application("chat_line")=line+1
113
Dim newsd(50)
114
j=1
115
for i=3 to 50 step 2
116
newsd(j)=sd(i)
117
newsd(j+1)=sd(i+1)
118
j=j+2
119
next
120
newsd(49)=line+1
121
newsd(50)=msgstr
122
Application("chat_sd")=newsd
123
Application.UnLock
124
125
dv_user=session("dv_user")
126
username=dv_user(0)
127
userline=dv_user(1)
128
sendtime=dv_user(2)
129
send_time=now()
130
sd=Application("chat_sd")
131
newuserline=0
132
for i=1 to 50 step 2
133
newuserline=sd(i)
134
if sd(i)>userline then
135
Response.Write "<script Language=JavaScript>"&sd(i+1)&"</script>"
136
end if
137
next
138
dv_user(1) = newuserline
139
dv_user(2) = send_time
140
session("dv_user")=dv_user
141
Response.End
142
end sub
143
144
sub showh()
145
if not isarray(session("dv_user")) then Response.End
146
dv_user=session("dv_user")
147
userline=dv_user(1)
148
sd=Application("chat_sd")
149
newuserline=0
150
for i=1 to 50 step 2
151
newuserline=sd(i)
152
if sd(i)>userline then
153
Response.Write "<script Language=JavaScript>"&sd(i+1)&"</script>"
154
end if
155
next
156
if newuserline>userline then dv_user(1)=newuserline
157
session("dv_user")=dv_user
158
Response.Write "<script Language=JavaScript>setTimeout('this.location.reload();',3000);</script>"
159
Response.End
160
end sub
161
162
sub modify()
163
%>
164
<html>
165
<head>
166
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
167
<title>聊天室</title>
168
<style type="text/css">
169
A:visited{TEXT-DECORATION: none;Color:#000000}
170
A:active{TEXT-DECORATION: none;Color:#000000}
171
A:hover{TEXT-DECORATION: underline;Color:#000000}
172
A:link{text-decoration: none;Color:#000000}
173
BODY{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;
174
background-color:#CCCCFF;
175
margin-top:3px;
176
margin-bottom:2px;
177
}
178
TD,p,div,br{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;Color:#000000;}
179
FORM{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
180
OPTION{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
181
INPUT{BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc; font-family: "宋体"; font-size: 12px}
182
select {border-width: 1px; border-color: #000000; background-color: #eeeeee; font-family: "宋体"; font-size: 12px;}
183
</style>
184
</head>
185
<body>
186
<%
187
if request("opa")="modify" then
188
if not isarray(session("dv_user")) then
189
Response.Redirect "chat_index.asp?action=exitchat"
190
else
191
dv_user=session("dv_user")
192
newname=Request.Form ("newname")
193
if Instr(LCase(Application("onlinelist")),LCase(newname&" "))<>0 then
194
Response.Write "<script>alert('系统中己存在这个用户名!');this.location.href='chat_index.asp?action=modify';</script>"
195
Response.End
196
end if
197
198
Application.lock
199
Application("onlinelist")=replace(Application("onlinelist"),dv_user(0)&" ",newname&" ")
200
Application.Unlock
201
202
msgstr="parent.showmsg('1','"&dv_user(0)&"','大家','【系统消息】"&dv_user(0)&"己改名为<a href=javascript:parent.setuser(\'"&newname&"\'); target=talk>"&newname&"</a>!','AA00CC','0','"&time()&"'); "
203
Application.Lock
204
sd=Application("chat_sd")
205
line=int(Application("chat_line"))
206
Application("chat_line")=line+1
207
Dim newsd(50)
208
j=1
209
for i=3 to 50 step 2
210
newsd(j)=sd(i)
211
newsd(j+1)=sd(i+1)
212
j=j+2
213
next
214
newsd(49)=line+1
215
newsd(50)=msgStr
216
Application("chat_sd")=newsd
217
Application.UnLock
218
219
dv_user(0)=newname
220
session("dv_user")=dv_user
221
Response.Write "<script language=javascript>parent.username='"&newname&"';parent.talk.document.talk.username.value='"&newname&"';parent.listh.location.reload();this.location.href='chat_index.asp?action=modify';</script>"
222
end if
223
else
224
%>
225
<form method="post" action="chat_index.asp?action=modify&opa=modify" name="modifyname">改 名: <input name="newname" type="text" size="10"> <input name="" type="submit" value="改名"></form>
226
<%
227
end if
228
%>
229
</body>
230
</html>
231
<script language="javascript">
232
parent.talk.document.talk.content.focus();
233
</script>
234
<%
235
end sub
236
237
sub music()
238
%>
239
<html>
240
<head>
241
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
242
<title>聊天室</title>
243
<style type="text/css">
244
A:visited{TEXT-DECORATION: none;Color:#000000}
245
A:active{TEXT-DECORATION: none;Color:#000000}
246
A:hover{TEXT-DECORATION: underline;Color:#000000}
247
A:link{text-decoration: none;Color:#000000}
248
BODY{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;
249
background-color:#CCCCFF;
250
margin-top:3px;
251
margin-bottom:2px;
252
}
253
TD,p,div,br{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;Color:#000000;}
254
FORM{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
255
OPTION{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
256
INPUT{BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc; font-family: "宋体"; font-size: 12px}
257
select {border-width: 1px; border-color: #000000; background-color: #eeeeee; font-family: "宋体"; font-size: 12px;}
258
</style>
259
<script language="javascript">
260
function ws(v){
261
var newv = escape(v);
262
var fv = v.substring(0, v.lastIndexOf("."));
263
if(newv == v || v.indexOf("'") != -1){
264
if(fv.length > 16){fv = fv.substring(0,16) + "…"}
265
document.write("<option value=\"" + v + "\">" + fv + "</option>");
266
}
267
else{
268
if(fv.length > 9){fv = fv.substring(0,9) + "…"}
269
document.write("<option value=\"" + v + "\">" + fv + "</option>");
270
}
271
}
272
function check(){
273
if(document.music.musiclist.selectedIndex == -1){
274
alert("请选择所需曲目。");
275
return false;
276
}
277
}
278
function playsong(){
279
if(document.music.musiclist.selectedIndex == -1){
280
alert("请选择所需曲目。");
281
return false;
282
}
283
sn = document.music.musiclist.options[document.music.musiclist.selectedIndex].value;
284
285
url = "song/" + escape(sn);
286
287
parent.musich.document.open();
288
parent.musich.document.writeln("<bgsound src=\"" + url + "\" loop=1>");
289
parent.musich.document.close();
290
parent.showmsg('1','','',"<font color=black>【点歌】</font>正在下载并播放歌曲<font color=A00000>《" + sn.substring(0, sn.lastIndexOf(".")) + "》</font>,请稍候……",'0088FF','0','<%=time()%>');
291
}
292
function stopsong(){
293
parent.musich.location.href = "about:blank";
294
}
295
</script>
296
</head>
297
<body>
298
<form name="music" method="post" onsubmit="return(check())">
299
点歌:
300
<select name="musiclist">
301
<option>----------</option>
302
<%
303
Set fs=CreateObject("Scripting.FileSystemObject")
304
songpath=Server.Mappath("song")
305
Set f=fs.GetFolder(songpath)
306
Set fc=f.Files
307
For Each f1 in fc
308
fn=f1.name
309
Response.Write "<script>ws(" & chr(34) & fn & chr(34) & ");</script>" & chr(13) & chr(10)
310
next
311
Set f=nothing
312
Set fc=nothing
313
Set fs=nothing
314
%>
315
</select>
316
<input type="button" name="play" value="播放" onclick="javascript:playsong();parent.talk.document.talk.content.focus();">
317
<input type="button" name="stop" value="停止" onclick="javascript:stopsong();parent.talk.document.talk.content.focus();">
318
</form>
319
</body>
320
</html>
321
<%
322
end sub
323
324
sub talk()
325
%>
326
<html>
327
<head>
328
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
329
<title>聊天室</title>
330
<style type="text/css">
331
A:visited{TEXT-DECORATION: none;Color:#000000}
332
A:active{TEXT-DECORATION: none;Color:#000000}
333
A:hover{TEXT-DECORATION: underline;Color:#000000}
334
A:link{text-decoration: none;Color:#000000}
335
.t{LINE-HEIGHT: 1.4}
336
BODY{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;
337
background-color:#CCCCFF;
338
margin-top:3px;
339
margin-bottom:2px;
340
}
341
TD,p,div,br{FONT-FAMILY: "宋体"; FONT-SIZE: 12px;Color:#000000;}
342
FORM{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
343
OPTION{FONT-FAMILY: "宋体"; FONT-SIZE: 12px}
344
INPUT{BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc; font-family: "宋体"; font-size: 12px}
345
select {border-width: 1px; border-color: #000000; background-color: #eeeeee; font-family: "宋体"; font-size: 12px;}
346
</style>
347
<script language=javascript>
348
username=parent.getuser();
349
function selway(){if(document.talk.secret.value=='0'){document.talk.secret.value='1'}else{document.talk.secret.value='0'}}
350
function bs(){
351
document.talk.content.style.color=document.talk.msgcolor.value;
352
document.talk.content.focus();}
353
function send()
354
{
355
var post_content=document.talk.post_content.value
356
var content=document.talk.content.value
357
while(post_content.indexOf(">") != -1 || post_content.indexOf("<") != -1 || post_content.indexOf(" ") != -1 || post_content.indexOf(" ") != -1 || post_content.indexOf(",") != -1 || content.indexOf(" ") != -1 || content.indexOf(" ") != -1 || content.indexOf(",") != -1 || content.indexOf("<") != -1 || content.indexOf(">") != -1){
358
post_content = post_content.replace(" ","");
359
post_content = post_content.replace(" ","");
360
post_content = post_content.replace(",","");
361
post_content = post_content.replace("<","<")
362
post_content = post_content.replace(">",">")
363
content = content.replace(" ","");
364
content = content.replace(" ","");
365
content = content.replace(",","");
366
content = content.replace("<","<")
367
content = content.replace(">",">")
368
}
369
if (content==''){alert('请输入发言!');document.talk.content.focus();return false}
370
if (content==post_content){alert('请不要重复发言!!');document.talk.content.focus();return false}
371
this.document.talk.Submit.disabled=1;
372
this.document.talk.post_content.value=content;
373
this.document.talk.content.value='';
374
this.document.talk.tu.value='0';
375
setTimeout("document.talk.Submit.disabled=0;",3000);
376
document.talk.content.focus();
377
}
378
function exit(){
379
if(confirm('您确定要退出聊天室吗?')){
380
setTimeout("top.location.href='chat_index.asp?action=exitchat';", 500);
381
}
382
}
383
function chgfoc()
384
{
385
document.talk.content.focus();
386
var e = event.srcElement;
387
var r =e.createTextRange();
388
r.moveStart("character",e.value.length);
389
r.collapse(true);
390
r.select();
391
}
392
</script>
393
</head>
394
<body onLoad="document.talk.content.focus();">
395
<form name="talk" method="post" target="send" action='chat_index.asp?action=send' onsubmit='return(send());'>
396
发言人:
397
<input type=text name='username' value='' readonly style="text-align:center;font-size:12px;color:CC3366" size=10 maxlength=10>
398
颜色:
399
<select name='msgcolor' onchange="document.talk.content.focus();bs(document.talk.msgcolor.value)" style='font-size:12px'>
400
<option style="background-color:000000;color:000000" value="000000">黑色</option>
401
<option style="background-color:0088FF;color:0088FF" value="0088FF">海蓝</option>
402
<option style="background-color:0000FF;color:0000FF" value="0000FF">亮蓝</option>
403
<option style="background-color:000088;color:000088" value="000088">深蓝</option>
404
<option style="background-color:888800;color:888800" value="888800">黄绿</option>
405
<option style="background-color:008888;color:008888" value="008888">蓝绿</option>
406
<option style="background-color:008800;color:008800" value="008800">橄榄</option>
407
<option style="background-color:8888FF;color:8888FF" value="8888FF">淡紫</option>
408
<option style="background-color:AA00CC;color:AA00CC" value="AA00CC">紫色</option>
409
<option style="background-color:8800FF;color:8800FF" value="8800FF" selected>蓝紫</option>
410
<option style="background-color:888888;color:888888" value="888888">灰色</option>
411
<option style="background-color:CCAA00;color:CCAA00" value="CCAA00">土黄</option>
412
<option style="background-color:FF8800;color:FF8800" value="FF8800">金黄</option>
413
<option style="background-color:CC3366;color:CC3366" value="CC3366">暗红</option>
414
<option style="background-color:FF00FF;color:FF00FF" value="FF00FF">紫红</option>
415
<option style="background-color:3366CC;color:3366CC" value="3366CC">蓝黑</option>
416
</select>
417
418
图片:
419
<select name='tu' onchange="document.talk.content.value=(this.value);chgfoc();" style='font-size:12px'>
420
<option value="0" selected>----</option>
421
<option value="[tu]1[/tu]">我的天</option>
422
<option value="[tu]2[/tu]">开心</option>
423
<option value="[tu]3[/tu]">555~~</option>
424
<option value="[tu]4[/tu]">哇有趣</option>
425
<option value="[tu]5[/tu]">必胜</option>
426
<option value="[tu]6[/tu]">支持</option>
427
<option value="[tu]7[/tu]">怕怕</option>
428
<option value="[tu]8[/tu]">讨厌</option>
429
<option value="[tu]9[/tu]">收到</option>
430
<option value="[tu]10[/tu]">不解</option>
431
<option value="[tu]11[/tu]">靠</option>
432
<option value="[tu]12[/tu]">傻了</option>
433
<option value="[tu]13[/tu]">大汗</option>
434
<option value="[tu]14[/tu]">汗!!!</option>
435
<option value="[tu]15[/tu]">欠揍</option>
436
<option value="[tu]16[/tu]">踩~</option>
437
<option value="[tu]17[/tu]">什么</option>
438
<option value="[tu]18[/tu]">砍~</option>
439
<option value="[tu]19[/tu]">正点</option>
440
<option value="[tu]20[/tu]">晕死</option>
441
<option value="[tu]21[/tu]">开心点</option>
442
<option value="[tu]22[/tu]">路过</option>
443
<option value="[tu]23[/tu]">你个猪头</option>
444
<option value="[tu]24[/tu]">送你的花</option>
445
<option value="[tu]25[/tu]">挖哈哈哈</option>
446
<option value="[tu]26[/tu]">拜拜了你
</option>
447
</select>
448
<input type=checkbox name='secret' value='0' onclick=selway();>
449
<a href=# onClick='document.talk.secret.checked=!(document.talk.secret.checked);selway();document.talk.content.focus();' title="“激活/禁止”私聊开关">私聊</a>
450
<input type='checkbox' name='as' accesskey='a' checked onClick='parent.scrollit()'>
451
<a href=# onClick='document.talk.as.checked=!(document.talk.as.checked);parent.scrollit();document.talk.content.focus();' title="“激活/禁止”对话区自动滚屏">滚屏</a>
452
453
<br>
454
对话人:
455
<input type=text name='towho' value='大家' readonly onclick=javascript:document.talk.towho.value='大家';document.talk.content.focus(); style="text-align:center;font-size:12px;color:CC3366" size=10 maxlength=10>
456
<input type=hidden name=post_content value=''>
457
对话:
458
<input type="text" name="content" size="40" style='font-size:12px'>
459
<input type="submit" name="Submit" value="提交">
460
<span style=" padding-left:100px; vertical-align:middle;">
461
<a href=# onclick=exit();>退 出</a>------离开时请点这里,谢谢!
462
</span>
463
</form>
464
</body>
465
</html>
466
<script>
467
bs()
468
document.talk.username.value=username;
469
parent.write();
470
</script>
471
<%
472
end sub
473
474
sub main()
475
randomize()
476
mum=int(rnd*9999)
477
username="游客"&mum
478
if Application("chat_line")="" then
479
Dim sd_init(50)
480
for i=1 to 48
481
sd_init(i)=0
482
next
483
sd_init(49)=1
484
sd_init(50)="数组初始化成功!"
485
Application("chat_sd")=sd_init
486
Application("chat_line")=1
487
Application("onlinelist")=""
488
end if
489
if not isarray(session("dv_user")) then
490
dim dv_user(3)
491
dv_user(0)=username
492
dv_user(1)=Application("chat_line")
493
dv_user(2)=now()
494
dv_user(3)=0
495
session("dv_user")=dv_user
496
else
497
dv_user=session("dv_user")
498
end if
499
500
if Instr(LCase(Application("onlinelist")),LCase(dv_user(0)&" "))=0 then
501
Application.lock
502
Application("onlinelist")=Application("onlinelist")&dv_user(0)&" "
503
Application.UnLock
504
if dv_user(3)=0 then
505
Application.lock
506
sd=Application("chat_sd")
507
line=int(Application("chat_line"))
508
Application("chat_line")=line+1
509
Dim newsd(50)
510
j=1
511
for i=3 to 50 step 2
512
newsd(j)=sd(i)
513
newsd(j+1)=sd(i+1)
514
j=j+2
515
next
516
newsd(49)=line+1
517
newsd(50)="parent.showmsg('1','"&dv_user(0)&"','大家','【系统消息】<a href=javascript:parent.setuser(\'"&dv_user(0)&"\'); target=talk>【"&dv_user(0)&"】</a>进入聊天室!','AA00CC','0','"&time()&"'); "
518
Application("chat_sd")=newsd
519
Application.UnLock
520
end if
521
dv_user(3)=1
522
session("dv_user")=dv_user
523
end if
524
525
%>
526
<html>
527
<head>
528
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
529
<title>聊天室</title>
530
<script language=javascript>
531
var username='<%=session("dv_user")(0)%>';
532
var autoScroll=1;
533
var lheight=140;
534
var fsize=10.5;
535
var bgcolor='#99ccff';
536
var chatimage='1';
537
var tbclu='true'
538
var ph = "<%=ph%>";
539
var masklist=' ';
540
541
function write()
542
{
543
parent.show.document.open();
544
parent.show.document.writeln("<html><head><title>聊天室</title><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\">");
545
parent.show.document.writeln("<style type=text/css>.p{font-size:20pt}.l{line-height:" + lheight + "%}.t{color:Fshowmsg0FF;font-size:9pt;}body{font-family:\"宋体\";font-size:" + fsize + "pt;line-height:" + lheight + "%}INPUT{BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-BOTTOM-WIDTH: 1px; BACKGROUND-COLOR: #efefef; BORDER-RIGHT-WIDTH: 1px}A{text-decoration:none}div{background:#fdf5e6;line-height:" + lheight + "%}td{font-family:\"宋体\";font-size:" + fsize + "pt;}A:Hover{text-decoration:underline}A:visited{color:blue}</style></head>");
546
parent.show.document.writeln("<body topmargin=3 bgcolor=#eeeeee>");
547
parent.show.document.writeln("<\script>function autoscrollnow(){this.scroll(0,80000);}<\/script>");
548
parent.show.document.writeln("<span><font color=purple><b>---------------------------------------聊天中心---------------------------------------</b></font></span>");
549
parent.show.document.writeln("<table width=500 align=center><tr width=100%><td align=left><font color=purple><pre> _ _<br> ( \\/ )<br> .---. \\ / .-\"-.<br> / 6_6 \\/ / 4 4 \\<br> \\_ (__\\ \\_ v _/<br> // \\\\ // \\\\<br> (( )) (( ))<br> =======\"\"===\"\"========\"\"===\"\"=======<br> ||| |||<br> | |</pre></font></td></tr></table>");
550
parent.show.document.writeln("<span><font color=red>【系统消息】</font>欢迎【"+username+"】光临!</span><br>");
551
}
552
function setuser(str){parent.talk.document.talk.towho.value=str;parent.talk.document.talk.content.focus();}
553
function showmsg(type,from,to,content,msgcolor,secret,saytime)
554
{
555
if(type=='0'){
556
if (from==username)
557
{var zj="【<a href=javascript:parent.setuser('"+from+"'); target=talk><font color='#CC3366'>我</font></a>】";}
558
else
559
{var zj="<a href=javascript:parent.setuser('"+from+"'); target=talk><font color='#CC3366'>"+from+"</font></a>";}
560
if (to==username)
561
{var br="【<a href=javascript:parent.setuser('"+to+"'); target=talk><font color='#CC3366'>我</font></a>】";}
562
else
563
{var br="<a href=javascript:parent.setuser('"+to+"'); target=talk><font color='#CC3366'>"+to+"</font></a>";}
564
565
//私聊
566
if (secret=='1')
567
{msg="<font color=red>〖私聊〗</font>"+zj+"对"+br+"说:<font color="+msgcolor+">"+content+"</font>";}
568
else
569
{msg=zj+"对"+br+"说:<font color="+msgcolor+">"+content+"</font>"}
570
571
if (secret=='1' && (from!=username && to!=username)){return false}
572
msg=msg+"<font color=red size=1pt>("+saytime+")</font><br>"
573
574
parent.show.document.writeln(msg);
575
if (autoScroll==1) {parent.show.autoscrollnow();}
576
}else{
577
msg="<font color="+msgcolor+">"+content+"</font><br>"
578
parent.show.document.writeln(msg);
579
}
580
}
581
582
function scrollit(){
583
if(!parent.talk.document.talk.as.checked)
584
{autoScroll=0;}
585
else
586
{autoScroll=1;parent.show.autoscrollnow();}
587
}
588
function getuser()
589
{
590
return username;
591
}
592
window.resizeTo(window.screen.width,window.screen.height-29);
593
window.moveTo(0,0);
594
window.focus();
595
</script>
596
</head>
597
598
<frameset rows="*,75" cols="*" border="0" framespacing="0">
599
<frameset rows="*" cols="*,171" framespacing="0" border="0">
600
<frameset rows="0,*" cols="*" framespacing="0" border="0">
601
<frame src="chat_index.asp?action=showh" name="showh" frameborder="NO" scrolling="NO" noresize>
602
<frame src="about:blank" name="show">
603
</frameset>
604
<frameset rows="0,*" cols="*" framespacing="0" border="0">
605
<frame src="chat_index.asp?action=listh" name="listh" scrolling="NO" noresize>
606
<frame src="about:blank" name="list" noresize>
607
</frameset>
608
</frameset>
609
<frameset rows="50,25,0" cols="*" border="0" framespacing="0">
610
<frame src="chat_index.asp?action=talk" name="talk" scrolling="NO" noresize>
611
<frameset rows="*" cols="200,*,0" framespacing="0" border="0">
612
<frame src="chat_index.asp?action=modify" name="modify" frameborder="NO" scrolling="NO" noresize>
613
<frame src="chat_index.asp?action=music" name="music" frameborder="NO" scrolling="NO" noresize>
614
<frame src="about:blank" name="musich" frameborder="NO" scrolling="NO" noresize>
615
</frameset>
616
<frame src="chat_index.asp?action=send" name="send" frameborder="NO" scrolling="NO" noresize>
617
</frameset>
618
</frameset>
619
<noframes><body bgcolor="#FFFFFF" text="#000000">
620
621
</body></noframes>
622
</html>
623
<%
624
end sub
625
%>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库