摘要: 关于js中的继承,网上有很多文章了,在这里我写出自己对js中的继承的理解。第一个阶段:functionA(){this.funB=function(){alert('A:funB');};}A.prototype={funA:function(){alert('A:funA');}};functionB(){}functionextend(sub,parent){sub.prototype=newparent();sub.prototype.constructor=sub;}extend(B,A);varb=newB();b.funA();//out'A 阅读全文
posted @ 2011-08-26 18:49 OD 阅读(1978) 评论(9) 推荐(2) 编辑