8.7w+
社区成员
function sendPHP(msg){
url="1.php?name="+name+"&msg="+msg+"&sid="+Math.random(); //对话部分
xmlHttp_1.onreadystatechange=stateChanged_1;
xmlHttp_1.open("GET",url,true)
xmlHttp_1.send(null)
if(msg!="") {msg=""; editor.body.innerHTML=""; }
url="2.php?name="+name+"&sid="+Math.random(); //在线部分
xmlHttp_2.onreadystatechange=stateChanged_2;
xmlHttp_2.open("GET",url,true)
xmlHttp_2.send(null)
setTimeout(function(){sendPHP(msg)},1000);
}
function stateChanged_1(){
if (xmlHttp_1.readyState==4 || xmlHttp_1.readyState=="complete")
document.getElementById("show").innerHTML=xmlHttp_1.responseText;
}
function stateChanged_2(){
if (xmlHttp_2.readyState==4 || xmlHttp_2.readyState=="complete")
document.getElementById("person").innerHTML=xmlHttp_2.responseText;
}
function sendPHP(msg)
{
//用2个xmlHttp分别向2个php文件发送并返回信息
}
setInterval("sendPHP('msg')",1000);