解决方案 »

  1.   

    var sound = {echo: function() { alert("sound"); } };function Person() {this.name="name_";};Person.prototype = sound;//----早点绑上去----var fo1o = new Person(); var xxxxxx=Person.prototype;//----迟了绑上去----??xxxxxx.yyyy="yyyy_"; alert(fo1o.echo);//alert(undefined);
    alert(fo1o.yyyy);//alert(undefined);
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    var sound = {echo: function() { alert("sound"); } };function Person() {this.name="name_";};var fo1o = new Person(); Person.prototype = sound;//----迟了绑上去----var xxxxxx=Person.prototype;//----迟了绑上去----??xxxxxx.yyyy="yyyy_"; alert(fo1o.echo);//alert(function(){....});
    alert(fo1o.yyyy);//alert("yyyy_");//为什么alert(fo1o.yyyy)会受到影响。
      

  2.   

    而且,你两个例子,写反了。alert的显示值,写反了
      

  3.   

    function Person() {};
    Person.prototype = {a:1};
    var fo1o = new Person(); 
    Person.prototype = {a:2};
    var fo2o = new Person(); alert(fo1o.a);//1
    alert(fo2o.a);//2对象继承的不是构造函数本身,而是构造函数的prototype
    当构造函数的prototype被重新赋值后,构造函数所创建的新对象也会不同
      

  4.   

    我对prototype断链的理解
    http://write.blog.csdn.net/postlist
      

  5.   

    错了,是这个地址
    http://blog.csdn.net/xanxus46/article/details/23873475
      

  6.   


    var sound = {echo: function() { alert("sound"); } };
    function Person() {this.name="name_";};
     
    var test_1 = new Person();//test_1先实例
    Person.prototype.sound;
    var test_2 = new Person();//test_2后实例var xxxxxx=Person.prototype;//----迟了绑上去---- 
    xxxxxx.yyyy="yyyy_1"; 
       
    alert(test_1.echo);//undefined
    alert(test_1.yyyy);//alert("yyyy_");  
    alert(test_2.echo);//undefined
    alert(test_2.yyyy);//alert("yyyy_"); 
    //结果什么事 yyyy存在,而echo不存在。
    //我都打错字吗?
      

  7.   

    = sound;和.sound;出问题了。
    OK