给onreadystatechange赋了程序了就不要在别的地方调用hsc了,因为那样responseText会出错。
程序代码:
<script>
onload=function(){cxhr();setInterval("cxhr()",2000);}
function XMLHttps(){
var ret=null;
try {ret=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try {ret=new ActiveXObject("Microsoft.XMLHTTP")}catch(ee){ret=null;}}
if(!ret&&typeof XMLHttpRequest !="undefined"){ret=new XMLHttpRequest();}
return ret;
}
function cxhr(){
var xmlHttp=XMLHttps();
xmlHttp.open("GET","onlineserver.asp",false);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4 && xmlHttp.status==404){alert("读取页面失败");return false;}
if(xmlHttp.readyState==4 && xmlHttp.status==500){alert("程序执行错误");return false;}
if(xmlHttp.readyState==4 && xmlHttp.status==200){book.innerHTML=xmlHttp.responseText;}}
xmlHttp.send(null);
}
</script>










谢谢大家的指点,非常感谢,我去调试一下,请问刚才提到浏览页刷无刷新更新数据后的浏览器活动停止,更新后恢复正常是什么原因?属性为false同步的时候的问题吗?