手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >JS 继承实例分析
JS 继承实例分析
摘要:复制代码代码如下:functionP(name){this.name=name;this.p1=function(){alert('Pare...

复制代码 代码如下:

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();

}

【JS 继承实例分析】相关文章:

JS继承用法实例分析

JQuery中DOM事件冒泡实例分析

打字效果

JQuery球队选择实例

JQuery中DOM加载与事件执行实例分析

JQuery中Text方法用法实例分析

Javascript中With语句用法实例

Javascript节点关系实例分析

JavaScript事件委托实例分析

javascript基于DOM实现权限选择实例分析

精品推荐
分类导航