#2
programlv2009-08-14 11:22
|
function send_request(url,str) {
var http_request = false;
if(window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType){
http_request.overrideMimeType('text/xml');
}
}else if(window.ActiveXObject){
try {http_request = new ActiveXObject("Msxml2.XMLHTTP");}catch (e){
try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}
}
}
if (!http_request) {
window.alert("不能创建XMLHttpRequest对象实例.");
return false;
}
http_request.open("GET",url, true);
http_request.onreadystatechange=function(){
if (http_request.readyState == 4) {
if (http_request.status == 200) {
document.getElementById(str).innerHTML= http_request.responseText;
} else {
alert("您所请求的页面有异常。");
}
}
}
http_request.send(null);
}
运行这段代码时,提示说“您所请求的页面有异常”请问:如果要避免出现这个提示,这个函数所输入的参数有什么要求,或者说,用什么办法能避免出现这个提示