- 爱易网页
-
ASP教程
- XMLHTTP+Javascript+Asp写得聊天室,无刷新实现(六)
日期:2011-02-12 浏览次数:20951 次
#############续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://edu.cnzz.cn/NewsInfo/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 >
</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" >
<input type="hidden" name="oldsays" >
<input name="F" maxlength="10" size="10" value="<%=session("u_name")%>" readonly style="BACKGROUND-COLOR: #76aadd; BORDER-BOTTOM: 0px double; BORDER-LEFT: 0px double; BORDER-RIGHT: 0px double; BORDER-TOP: 0px double; COLOR: #ffffff; TEXT-ALIGN: right">
对 <select name="T" >
<option value="大家" selected>大家</option>
</select> 说:<input type=text name="says" maxlength="150" size="50" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000" accesskey="t" title="发表对话区(Alt+T)可激活!" LANGUAGE="javascript ">
<input type="submit" name="send" value="发言" class="an" accesskey="s" title="(Alt+S)">
</form></td></tr></table>
<div style="HEIGHT: 80px; LEFT: 15px; POSITION: absolute; TOP: 30px; WIDTH: 600px">
<form name="oT">
<table BORDER="0" width="600" cellspacing="0" cellpadding="0">
<tr>
<td width="160" height="16" align="center" nowrap valign="top">
<input accesskey="a" type="checkbox" name="as" checked ><A onclick=moveself(); title=" “激活/禁止”对话区自动滚屏(Alt+A)!">滚屏</A>
</td>
<td width="230" height="16" align="left" nowrap valign="top"> <span title=" 改变你的发言的字体颜色(Alt+F)!">
<select name=usercolor accesskey="f" >
<OPTION selected style="COLOR: #000000" value="000000">默认颜色</OPTION>
<OPTION style="COLOR: #000000" value="#000000">黑色沉静</OPTION>
<option style="COLOR: #ff0000" value='#FF0000'>红色热情</option>
<option style="COLOR: #0000ff" value='#0000FF'>蓝色开朗</option>
<option sty
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。