首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript 承袭

2012-09-03 
javascript 继承function SuperType(name){this.name namethis.colors [“red”, “blue”, “green”]}Su

javascript 继承

function SuperType(name){this.name = name;this.colors = [“red”, “blue”, “green”];}SuperType.prototype.sayName = function(){alert(this.name);};function SubType(name, age){SuperType.call(this, name);this.age = age;}inheritPrototype(SubType, SuperType);SubType.prototype.sayAge = function(){alert(this.age);};

热点排行