function InitializeXMLHttpRequest(req){
if (req != null) req.abort();
if (typeof XMLHttpRequest != "undefined") req = new XMLHttpRequest();
else{ try { req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e) {
try { req=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(oc){ req=null;}
}
}
return req;
}
var reqChat = null;
reqChat = InitializeXMLHttpRequest(reqChat);
reqChat.onreadystatechange = ProcessCheckStatusResult;
function ProcessCheckStatusResult(){
status+='+';
if (reqChat.readyState == 4){
if (reqChat.status == 200){
alert("ok");
}
}
}
function CheckStatus(){
reqChat = InitializeXMLHttpRequest(reqChat);
status+=' send';
var url = "2.htm?t=" + new Date().getTime();
reqChat.open('GET', url, true);
reqChat.send(null);
}
status='';
setInterval(CheckStatus, 5000);
Monday
little chat class
found this - haven't tested it but it looks like a nice start to make a simple chat.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment