function a(){
a.prototype.c="cc"
}
var aa=new a
alert(aa.c)//弹出cc
function b(){}
b.prototype.c="ccccc"
var bb=new b
alert(bb.c)//弹出ccccc

function c(){}
c.prototype=new a
alert(c.c)//弹出undefined
c=new b
alert(c.c)//弹出ccccc不好意思 刚才写错了   
原型链 写在里面的 就不行了

解决方案 »

  1.   

    为什么会弹出 undefined 啊 ?  迷惑中…………
      

  2.   

    晕 头晕了  下面才是原型链
    function a(){
    a.prototype.c="cc"
    }
    var aa=new a
    alert(aa.c)//弹出cc
    function b(){}
    b.prototype.c="ccccc"
    var bb=new b
    alert(bb.c)//弹出ccccc

    function c(){}
    c.prototype=new a
    var cc=new c
    alert(cc.c)//弹出cc
    function d(){}
    d.prototype=new b
    var dd=new d
    alert(dd.c)//弹出ccccc