源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JS 继承实例分析

  • 时间:2022-08-30 13:04 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JS 继承实例分析
[u]复制代码[/u] 代码如下:
function P(name){ this.name=name; this.p1=function(){ alert('Parent Constructor'); } return this; } function C(name,id){ //this.method=P; //this.method(name); //1st method //P.call(this,name); //2nd method P.apply(this,new Array(name));//3rd method this.id=id; this.dis=function(){ alert(this.name); } } function dis(){ alert(this.name); } function t(){ var cc=new C('N','Id'); cc.dis(); cc.p1(); }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部