function GetXmlHttpObject() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function GetInfo() {
var xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("您的浏览器不支持AJAX!");
return;
}
var keystr = document.getElementById("keyword").value;
var url = "InfoService.aspx";
url += "?key=" + encodeURI(keystr);
url += "&type=" + tempType;
url = url + "&r=" + Math.random();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
// try {
var f = xmlHttp.responseText;
ShowMsg(f);
// }
// catch (ex) {
// alert("发生意外错误:"+ex);
// }
}
};
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}