日期:2014-05-16  浏览次数:20867 次

AJAX问题:在IE中正常,但是在FF中显示不正常,请教! - Web 开发 / Ajax
function createxmlhttp()
{
  var xmlhttp = false;
  try{xmlhttp = new XMLHttpRequest;}
  catch(e)
  {try{xmlhttp =new ActiveXObject("MSXML2.XMLHTTP");}
  catch(e2){try{xmlhttp =new ActiveXObject("Microsoft.XMLHTTP");}
  catch(e3){xmlhttp = false;}}}
  return xmlhttp;


function channelbook(){
  var xmlhttp = createxmlhttp();
  xmlhttp.open("POST","bookmenu.txt",true);
  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlhttp.send(null);  
  xmlhttp.onreadystatechange=function(){
  if(xmlhttp.readystate==4)
  {if(xmlhttp.status==200)
  {document.getElementById("mainleft").innerHTML=xmlhttp.responseText;}
  else
  {document.getElementById("mainleft").innerHTML="对不起,您请求的页面有问题...";} }  
  else
  {document.getElementById("mainleft").innerHTML="加载中,请梢候...";}}  
}

以上是代码在IE中正常,但是在FF中显示“加载中,请梢候“,请高手指点

------解决方案--------------------
你看一下这里第一楼的注释,
http://topic.csdn.net/u/20111204/11/65a6b767-7f53-48ec-8a64-c2fcba4d1f4f.html