net.ContentLoader.prototype = {
loadXMLDoc: function(url){
if (window.XMLHttpRequest){
this.req = new XMLHttpRequest();
} else if (window.ActiveXObject){
this.req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (this.req){
try{
var loader = this; //this指什么?loadXMLDoc么?
this.req.onreadystatechange = function(){
loader.onReadyState.call(loader);//这句话是什么意思?
}
this.req.open('GET', url, true);
this.req.send(null);
}catch (err){
this.onerror.call(this);//还有这句话,是什么意思?
}
}
}
}

解决方案 »

  1.   

    1、你的回答是对的
    2、call来调用方法。method.call(object)的意思是object来调用method方法
    3、同2关于call 参考http://www.w3school.com.cn/js/pro_js_inheritance_implementing.asp
      

  2.   

    this  应该是 ContentLoader.prototype,即 ContentLoader 的原型!call 方法
    调用一个对象的一个方法,以另一个对象替换当前对象。call([thisObj[,arg1[, arg2[,   [,.argN]]]]])参数
    thisObj可选项。将被用作当前对象的对象。arg1, arg2,  , argN可选项。将被传递方法参数序列。说明
    call 方法可以用来代替另一个对象调用一个方法。call 方法可将一个函数的对象上下文从初始的上下文改变为由 thisObj 指定的新对象。如果没有提供 thisObj 参数,那么 Global 对象被用作 thisObj。
      

  3.   

    this 是指 net.ContentLoader 这个对象call来调用方法。method.call(object)的意思是object来调用method方法楼上2位说的很清楚了
      

  4.   

    +1
    两处的this都是指net.ContentLoader.prototype,或者说是new出来的net.ContentLoader。
      

  5.   

    call()方法:
    例如:
     function sayColor(sPrefix,sSuffix){
    alert(sPrefix + this.color + sSuffix);
     }var o = new Object;
    o.color = "red";
    sayColor.call(o,"The color is ", " not blue");
    这里call()方法中的第一个参数o赋值给sayColor中的this,第二个,第三个参数是字符串,最后打印信息。利用call()方法修改之前的继承方法,修改后如下:
    function ClassA(sColor){
        this.color = sColor;
    this.sayColor = function(){
    alert(this.color);
    }
    }function ClassB(sColor,sName){
    //this.newMethod = ClassA;
    //this.newMethod(sColor);
    //delete this.newMethod;
    // 这里的this等于ClassB对象
    // 所以下面这句话就等于ClassB赋值了ClassA里面的内容
    ClassA.call(this,sColor); this.name = sName;
    this.sayName = function(){
    alert(this.name);
    }
    }
    var objA = new ClassA("red");
    var objB = new ClassB("blue","Jim");
    objA.sayColor(); // red
    objB.sayColor(); // blue
    objB.sayName();  // Jim
      

  6.   

    js中的this与其他语言中的this是不同的
    js中的this指向的是包含此this所在函数运行的那个对象,包含this的那个函数运行的环境不同,this的指向也是不同的函数.call(this),是指把当前的this的作用域当作函数的作用域来运行这个函数
      

  7.   

    很有代表性的问题         var loader = this; //this指什么?loadXMLDoc么?
                    this.req.onreadystatechange = function(){
                        loader.onReadyState.call(loader);//这句话是什么意思?
                    }
                    }catch (err){
                    this.onerror.call(this);//还有这句话,是什么意思1、this代表的是调用函数的对象2、调用了call ,同时没有用this,因为this发生了变化,许多回调函数中不能用this3,call的调用,是为实现类继承