Xmlhttp+javascript+asp Write chat room, no refresh implementation (vi)
Last Update:2017-02-28
Source: Internet
Author: User
############ #续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);
}
Functions Getxmldata ()//This is the function that refreshes the user's XML data
{crld=1;
Ordom.load (Path)
if (oRDom.parseError.errorCode!= 0)
{Alert ("Sorry. Error occurred");
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= "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);d elete (ARYT);d elete (ARYSC);d elete (ARYCL);d elete (ARYSJ);
}
function towho (un) {
Document.say.t.options[0].value=un;
Document.say.t.options[0].text=un;
Document.say.says.focus ();
</script>
<base >
<body bgcolor= "#76b4d9" topmargin= "4" leftmargin= "1" >
<table border= "0" width= "767" cellspacing= "0" cellpadding= "0" >
<TR><TD width= "735" height= "align=" "left" nowrap>
<form method= "POST" action= "save.asp" name= "Say" target= "B" >
<input type= "hidden" name= "Oldsays" >
<input name= "F" maxlength= "size=" "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 ">
For <select name= "T" >
<option value= "Everyone" selected> everyone </option>
</select> said: <input type=text name= "says" maxlength= "" size= "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=" Publishing Dialog Area (alt+t) can be activated! "Language=" JavaScript >
<input type= "Submit" name= "Send" value= "speech" 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= "cellspacing=" 0 "cellpadding=" 0 ">
<tr>
<TD width= "160" height= "align=" "Center" nowrap valign= "Top" >
<input accesskey= "A" type= "checkbox" Name= "as" checked ><a (); title= "Activate/disable" dialog area automatic scrolling (alt+a)! "> Rolling screen </A>
</td>
<TD width= "230" height= "align=" "left" nowrap "the Top" > valign= <span "Change the font color of your speech (title=)!" ">
<select Name=usercolor accesskey= "F" >
<option selected style= "color: #000000" value= "000000" > Default color </OPTION>
<option style= "COLOR: #000000" value= "#000000" > Black silence </OPTION>
<option style= "COLOR: #ff0000" value= ' #FF0000 ' > Red Passion </option>
<option style= "COLOR: #0000ff" value= ' #0000FF ' > Blue cheerful </option>
<option style= "COLOR: #ff00ff" value= ' #FF00FF ' > Peach romance </option>
<option style= "COLOR: #009900" value= ' #009900 ' > Green Youth </option>
<option style= "COLOR: #009999" value= ' #009999 ' > Cyan refreshing </option>
<option style= "COLOR: #990099" value= ' #990099 ' > Purple prim </option>
<option style= "COLOR: #990000" value= ' #990000 ' > Night excitement </option>
<option style= "COLOR: #000099" value= ' #000099 ' > Blue Blues </option>
<option style= "COLOR: #999900" value= ' #999900 ' > Khaki uniform </option>
<option style= "COLOR: #ff9900" value= ' #FF9900 ' > Gilded years </option>
<option style= "COLOR: #0099ff" value= ' #0099FF ' > Lake Waves Ripple </option>
<option style= "COLOR: #9900ff" value= ' #9900FF ' > Bright blue violet </option>
<option style= "COLOR: #ff0099" value= ' #FF0099 ' > ' Hint of love </option>
<option style= "COLOR: #006600" value= ' #006600 ' > dark green deep </option>
<option style= "COLOR: #333333" value= ' #333333 ' > Grey trajectory </option>
<option style= "COLOR: #999999" value= ' #999999 ' > London grey Fog </option>
</select></span>
<span title= "Change the expression of your speech (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= "and chat with friends (ALT + M)! "><label for=ws > Private chat </label></A> </td>
<TD width= "height=" align= "left" nowrap valign= "Top" >
<input id=clock name=clock Type=button value=1200 "an" class= "if you do not speak for a long time (dive), please note: When the counter is reduced to 0 o'clock, you will be kicked out! "style=" color: #ff3300; width:60; "Disabled>
</td>
</tr>
</table> </form>
</div>
<script>
Write ();
Getxmldata ();
Clock ();
</script>
</body>