- -报错也算啊??  帮帮我搞定这个xmlHttp对象怎么处理吧。

解决方案 »

  1.   

    xmlHttp.onreadystatechange = this.handlereadychange();  //去掉后面的括号, 这里是赋值
    this.functions;  //加上括号, 这里是调用
      

  2.   

    function New(aClass,aparams)
    {
        function _new()
        {
            if(aClass.defulte)
            {
                aClass.defulte.apply(this,aparams);
            }
        }
        _new.prototype = aClass;
        return new _new();
    }
    var ajax =
    {
        defulte:function(web,func)
        {    
            this.web = web;
            this.functions = func;
        },
        createXMLHttpRequest: function()
        {
            var xmlHttp;
            if (window.ActiveXObject) 
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            else if (window.XMLHttpRequest) 
            {
                xmlHttp = new XMLHttpRequest();
            }
            return xmlHttp;
        },
        handlereadychange:function()
        {
            if(xmlHttp.readystate == 4)    //xmlhttp未定义
            {
                if(xmlHttp.status == 200)
                {
                    this.functions;
                }
            }
        },
        getSend:function()
        {
            var xmlHttp = this.createXMLHttpRequest();  //只要句柄
            xmlHttp.onreadystatechange = this.handlereadychange();
            xmlHttp.open("GET", this.web , true);
            xmlHttp.send(null);
        }
    }
      

  3.   

    function New(aClass,aparams) 

        function _new() 
        { 
            if(aClass.defulte) 
            { 
                aClass.defulte.apply(this,aparams); 
            } 
        } 
        _new.prototype = aClass; 
        return new _new(); 

    var ajax = 

        defulte:function(web,func) 
        {    
            this.web = web; 
            this.functions = func; 
        }, 
        createXMLHttpRequest: function() 
        { 
            var xmlHttp; 
            if (window.ActiveXObject) 
            { 
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
            } 
            else if (window.XMLHttpRequest) 
            { 
                xmlHttp = new XMLHttpRequest(); 
            } 
            return xmlHttp; 
        }, 
        handlereadychange:function() 
        { 
            if(xmlHttp.readystate == 4)    //xmlhttp未定义 
            { 
                if(xmlHttp.status == 200) 
                { 
                    this.functions; //...()
                } 
            } 
        }, 
        getSend:function() 
        { 
            var xmlHttp = this.createXMLHttpRequest();  
            xmlHttp.onreadystatechange = this.handlereadychange(); //() 
            xmlHttp.open("GET", this.web , true); 
            xmlHttp.send(null); 
        }