使用XML.而无须不断刷新*.ASP.
无刷新实现发言的逐条显示.
使用Application变量存储聊天记录,所以要需要建立一个虚拟目录
服务器端不需要支持XML,只要支持ASP和能建立虚拟目录就可以了.
以下代码在nt4.0+iis4.0上通过.我估计在你的win2000下也差不多吧.
如果有问题,请多多赐教:netnice@chinaok.net
##########index.asp##############################
<html>
<head>
<title>蓝蝶聊天室 Www.ChinaOk.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style TYPE="text/css">
BODY{FONT-SIZE: 9pt}
TD{FONT-SIZE: 9pt}
.tbljm{BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid;color:#000000;}
</style>
<script language="Javascript">
function openWin()
{winst="Status=yes,scrollbars=yes,resizable=yes,width="+(screen.availWidth-10)+",height="+(screen.availHeight-50)+",top=0,left=0";
window.open('about:blank','7923sdfsdfs',winst);
}
function form_onsubmit(obj)
{ var no=0,psd="1234567890";
if(obj.UserName.value==""){alert("请输入你的昵称!\n"); obj.UserName.focus(); return false;}
if(obj.UserName.value.indexOf(" ")>-1 ||obj.UserName.value.indexOf("'")>-1 || obj.UserName.value.indexOf("\"")>-1){alert("你的昵称含有非法字符!\n"); obj.UserName.focus(); return false;}
openWin();
return true;
}
</script>
</head>
<body bgcolor="#ffffff" text="#000000" valign="center" onload="javascript:document.form1.ok.blur()" background="images/greystrip.gif">
<center><TABLE border=0 width="67%">
<TBODY>
<TR>
<TD valign=center align="middle" style="FONT-SIZE: 10.5pt"><FONT color=#0033ff>::::: :::::</FONT> </TD>
</TR></TBODY></TABLE></center>
<table width="200" border="0" style="BORDER-RIGHT: #003366 1px solid; BORDER-TOP: #003366 1px solid; BORDER-LEFT: #003366 1px solid; BORDER-BOTTOM: #003366 1px solid" cellspacing="0" cellpadding="0" align="center">
<tr>
<td bgcolor="#304d7c" height="25">
<div align="center"><font color="#ffffff">用户登陆</font></div>
</td>
</tr>
<tr>
<td height="121">
<form name="form1" method="post" action="main.asp" onSubmit="return form_onsubmit(this)" target="7923sdfsdfs">
<table width="199" border="0" cellspacing="0" cellpadding="0" background="images/greystrip.gif">
<tr>
<td height="35">
<div align="center">用户名:
<input name="UserName" size="10" maxlength="20" class=tbljm>
</div>
&