急!我用responseText接收值,在IE中能正常显示,在firefox里却不能显示``` - Web 开发 / Ajax
我用responseText接收值,在IE中能正常显示,在firefox里却不能显示,不知道什么原应,请高手帮忙!
js代码:
function showpage(url)
{
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( "no CreateObject XMLHttpRequest. ");
return false;
}
http_request.onreadystatechange=processRequest;
http_request.open( "POST ",url,true);
http_request.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded; ");
http_request.send(null);
}
function processRequest(){
if(http_request.readystate==4){
if (http_request.status==200){
document.getElementById( 'content ').innerHTML=http_request.responseText;
} else {
alert( "ye mian yi chang ");
}
}
}
传值页面的代码:
<%
response.contenttype= "text/html;charset=iso-8859-1 "
response.write( "1234 ")
%>
------解决方案--------------------支持hejunbin(何俊斌) ,用firebug可以对javascript设断点。一般估计http_request在firefox中的创建过程出错(即你所贴程序的第一个子段{}),建议重点跟踪。