日期:2014-05-16 浏览次数:20323 次
function ChaoLei(){ this.ageone = 1; } ChaoLei.prototype.getChaoleiValue = function(){ return this.ageone; }; function ZiLei(){ this.agetwo = 2; } //继承了超类 ZiLei.prototype = new ChaoLei(); //添加新方法 ZiLei.prototype={ getZileiValue:function(){ return this.agetwo; }, //重写超类中的方法 [color=#FF0000]someOtherMether[/color]:function(){ return 3; } } var instance =new ZiLei(); alert (instance.getChaoleiValue());