这段代码在xp下正常,在vista下怎么就不行了呢?
var xmlHttp; //对触发的事件进行处理,指定URL,与该地址的服务器端文件进行交互
function startRequest(url) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}//建立XMLHttpRequest,并根据浏览器的不同来做出相应的设置,IE7推出后就可以不用考虑?
function createXMLHttpRequest() {if (window.ActiveXObject){xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
else if (window.XMLHttpRequest){xmlHttp = new XMLHttpRequest();}
}function handleStateChange() {
var particularDiv=document.getElementById("particularDiv"); if(xmlHttp.readyState == 4 || xmlHttp.readyState=="complete") {
if(xmlHttp.status == 200) { particularDiv.style.border = "2px solid #7B7BCD";
particularDiv.style.backgroundColor="#FFFFFF";
particularDiv.style.display = "";
particularDiv.innerHTML=xmlHttp.responseText;}
}
}
var xmlHttp; //对触发的事件进行处理,指定URL,与该地址的服务器端文件进行交互
function startRequest(url) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}//建立XMLHttpRequest,并根据浏览器的不同来做出相应的设置,IE7推出后就可以不用考虑?
function createXMLHttpRequest() {if (window.ActiveXObject){xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
else if (window.XMLHttpRequest){xmlHttp = new XMLHttpRequest();}
}function handleStateChange() {
var particularDiv=document.getElementById("particularDiv"); if(xmlHttp.readyState == 4 || xmlHttp.readyState=="complete") {
if(xmlHttp.status == 200) { particularDiv.style.border = "2px solid #7B7BCD";
particularDiv.style.backgroundColor="#FFFFFF";
particularDiv.style.display = "";
particularDiv.innerHTML=xmlHttp.responseText;}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货