XMLHTTP+Javascript+Asp写得聊天室,无刷新实现(六)
网络整理 - 07-26
#############续send.asp#################var oRDom=new ActiveXObject("Microsoft.XMLDOM");
oRDom.async=false;
var Path="reload.asp";
var tCok;
function Clock()
{cRld++;
if (cRld>10){cRld=1;GetXmlData();}
clearTimeout(tCok);
tCok=setTimeout("Clock()",1000);
}
function GetXmlData() //这就是刷新用户XML数据的函数
{cRld=1;
oRDom.load(Path)
if(oRDom.parseError.errorCode != 0)
{alert("Sorry.出现了错误");
return }
else
{
var aryF=oRDom.documentElement.selectNodes("F");
var aryT=oRDom.documentElement.selectNodes("T");
var arysC=oRDom.documentElement.selectNodes("sC");
var arycL=oRDom.documentElement.selectNodes("cL");
var arysJ=oRDom.documentElement.selectNodes("sJ");
var aryE=oRDom.documentElement.selectNodes("E");
var tmpHtml="";
lengt=aryF.length;
for(var i=0;i<lengt;i++){
img="<img src=http://www.newasp.net/Article/asp/xml/2005/girl.gif width=12 height=12 border=0>";
tmpHtml="<font style=\'cursor:hand;color:"+arycL(i).text+"\'>"+eV[aryE(i).text*2]+rp2(arysC(i).text,"{^amp]","&")+"</font> <span class=t>["+arysJ(i).text+"]</span><br>";
tmpHtml=rp2(tmpHtml,"$F","<a href=\"javascript:parent.sd.towho('"+aryF(i).text+"');\">"+img+aryF(i).text+"</a>");
tmpHtml=rp2(tmpHtml,"$T","<a href=\"javascript:parent.sd.towho('"+aryT(i).text+"');\">"+aryT(i).text+"</a>");
if (aryF(i).text==Me || aryT(i).text==Me)
{ parent.my.Ly.innerHTML+=tmpHtml;
} else
parent.pub.Ly.innerHTML+=tmpHtml;
}
}
delete(aryF);delete(aryT);delete(arysC);delete(arycL);delete(arysJ);
}
function towho(un){
document.say.T.options[0].value=un;
document.say.T.options[0].text=un;
document.say.says.focus();return;}
</script>
<base onmouseover="parent.window.status='欢迎光临 蓝蝶精品网 站长:NetNice QICQ:6097356 ';return true;">
</head>
<body bgcolor="#76b4d9" topmargin="4" leftmargin="1" >
<table BORDER="0" width="767" cellspacing="0" cellpadding="0" >
<tr><td width="735" height="16" align="left" nowrap>
<form method="post" action="save.asp" name="say" target="b" >伦敦灰雾</option>
</select></span>
<span title=" 改变您的说话时的表情(Alt+Q)!" ><select accesskey="q" name=userface style="FONT-SIZE: 9pt;width:65px" size="1">
<script language="Javascript">
for(var iF=0;iF<eV.length;iF+=2)
{document.writeln("<option value=\""+eV[iF]+"\">"+eV[iF+1]);
}
</script>
</select></span> <input TYPE="checkbox" name="ws" id="ws" accesskey="m" ><A title=" 和聊友说句悄悄话(Alt+M)!"><label for=ws >私聊</label></A> </td>
<td width="250" height="16" align="left" nowrap valign="top">
<INPUT id=clock name=clock type=button value=1200 class="an" title="如果您长时间不发言(潜水),请注意:当计数器减至零时,您将被被踢出!" style="color:#ff3300;width:60;" disabled>
</td>
</tr>
</table> </form>
</div>
<script>
write();
GetXmlData();
Clock();
</script>
</body>
</html>
原作者:netnice
来 源:chinaasp