日期:2014-05-16 浏览次数:20790 次
_createXMLHttpRequest = function() {
var xhr = null;
if(typeof XMLHttpRequest != 'undefined') {
xhr = new XMLHttpRequest();
}else{
var _msxmlhttp = new Array(
'Msxml2.XMLHTTP.6.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for(var i = 0; i < _msxmlhttp.length; i++) {
try {
if (xhr = new ActiveXObject(_msxmlhttp[i])) break;
} catch (e) {
xhr = null;
}
}
}
if(!xhr)
{
alert("Could not create connection object.");
}
return xhr;
};
<button type="button" id="bt1"></button> <button type="button" id="bt2"></button> <div id="bt3">这里按了bt1之后改变内容的地方</div> <duv id="bt4">这里按了bt2之后改变内容的地方</div>