标签:blog class code java ext get
<html>
<head>
<script type="text/javascript">
function FactoryXMLHttpRequest() {
if(window.XMLHttpRequest) {
return new XMLHttpRequest();
}else if(window.ActiveXObject) {
var msxmls = new Array(
‘Msxml2.XMLHTTP.5.0‘,
‘Msxml2.XMLHTTP.4.0‘,
‘Msxml2.XMLHTTP.3.0‘,
‘Msxml2.XMLHTTP‘,
‘Microsoft.XMLHTTP‘);
for (var i = 0; i < msxmls.length; i++) {
try {
return new ActiveXObject(msxmls[i]);
} catch (e) {
}
}
}
throw new Error("Could not instantiate XMLHttpRequest");
}
var xmlHttp = FactoryXMLHttpRequest();
xmlHttp.open("get","index.php",true);
xmlHttp.onreadystatechange =function(){
if(xmlHttp.readyState==4){
alert(xmlHttp.responseText);
}
}
xmlHttp.send(null);
</script>
</head>
<body>
</body>
</html>felayman---ajax对象的兼容写法,布布扣,bubuko.com
标签:blog class code java ext get
原文地址:http://blog.csdn.net/u012332735/article/details/25072265