本帖最后由 Learnfromeverthings 于 2010-11-30 22:59:46 编辑

解决方案 »

  1.   

      只能这执行到这个函数    alert(xmlhttp.readystate);提示未定义为什么啊
     
      function callback()
              {
              alert("callback");
            
             alert(xmlhttp.readystate);
                if(xmlhttp.readystate ==4)
                 {
                  alert("rr");
                    if(xmlhttp.status ==200)
                    {
                     alert("gggg");
                      var nn = xmlhttp.responseText;
                      alert(nn);
                     }
                  }
               }
      

  2.   

    callback()方法内xmlhttp对象没定义啊,要么做成参数传进来,要么设为全局变量。
      

  3.   

    var xmlHttp = false;
       try {
         xmlHttp = new XMLHttpRequest();
       } catch (trymicrosoft) {
         try {
           xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (othermicrosoft) {
           try {
             xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
           } catch (failed) {
             xmlHttp = false;
           }  
         }
       }
       if (!xmlHttp) {alert("启用Ajax功能失败,您可能无法使用本站的部分功能!");}
    ....xmlHttp.open("GET",url,true);   
      xmlHttp.onreadystatechange=ShowResult;   
      xmlHttp.send(null);   
      }   
      }   
      function ShowResult()   
      {   
      if(xmlHttp.readyState==4)   
      {   
      if(xmlHttp.status==200)   
      {   
      var s;   
      s=xmlHttp.responseText;   
      alert(s);   
      }   
      }   
      }   
      

  4.   

    alert(xmlhttp.readystate);改为
    alert(xmlhttp.readyState);
      

  5.   

    对,要大写S,否则ie下正常而firefox下不正常。
      

  6.   

    对,要大写S,否则ie下正常而firefox下不正常。ie 7 以下吧