var url = "chat.asp?clien="+nowNum+"&cont="+createQueryString("inputs")+named+"&timeStamp="+new Date().getTime();
xmldoc.open("GET",url,true);
xmldoc.onreadystatechange = CheckState;
xmldoc.setRequestHeader("Content-Type","text/xml;charset=GB2312;");
xmldoc.send(null);
getId("errors").innerHTML = ""
addChat(createQueryString("inputs"));
clean()
focs()
}else{
getId("loadifo").innerHTML = "请输入对话内容!"
focs()
}
}
function CheckState(){
if(xmldoc.readyState == 1){
//getId("loadifo").innerHTML = "连接服务器"
}
else if(xmldoc.readyState == 2){
//getId("loadifo").innerHTML = "开始加载数据"
}
else if(xmldoc.readyState == 3){
//getId("loadifo").innerHTML = "正在加载数据"
}
else if(xmldoc.readyState == 4){
if(xmldoc.status == 200){
results()
}
else{
getId("loadifo").innerHTML = "错误"+xmldoc.status;
focs()
}
}
}
function results(){
resXml()
}
function resXml(){
var res = xmldoc.responseXML.documentElement;
var resLen = res.getElementsByTagName("items").length
if(getTag(res,0,"num") != nowNum){
//alert(xmldoc.responseXML.xml)
nowNum = getTag(res,0,"num")
for(var i=0; i<resLen; i++){
var useName = getTag(res,i,"name")
var useMag = getTag(res,i,"conts")
var useIp = getTag(res,i,"ip")