phpe
新手上路

UID 98106
精华
0
积分 33
帖子 38
金钱 33 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2007-9-6
状态 离线
|
Ajax异步请求,为什么会拖死浏览器!
每三秒xmlhttp.open一次,需要做什么样的处理,才不会导致浏览器假死!!!!
<javascript>
function get_msg(){
try
{
xmlhttp=new XMLHttpRequest();
}
catch(e)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if(4==xmlhttp.readystate){
if(200==xmlhttp.status){
//............
}
else
{
textmsg.innerHTML +='<div style="margin-top:5px;">
<font color=\"#ff0000\">【提示:】服务器通信失败!</font></div>';
xmlhttp.abort();
}
}
}
xmlhttp.open("get",'../message/show_top.php',true);
xmlhttp.setRequestHeader('content-type','application/x-www-form-urlencoded');
xmlhttp.send(null);
}
setInterval("get_msg()",3000);
</script> 当网络卡的时候才会出现,
而且前几分钟都没啥问题,返回的数据也正常。
[ 本帖最后由 phpe 于 2007-9-15 10:37 AM 编辑 ]
|  人生就像拉屎,你已经很努力了,可是拉出来的只是个屁!· |
|