Mootools 1.2教程

Mootools 1.2系列教程目录

时间:2015-07-13 19:41来源:网络整理 作者:KKWL 点击:
liul says: April 10, 2009 at 3:04 pm var classaInstance=new ClassA('param1'); function test1(){ classaInstance.fun1(); } function test2(){ classaInstance.fun1(); classaInstance.fun2('param-fun2') classaInstance.fun1(); } var ClassB=ClassA.e

liul says:

April 10, 2009 at 3:04 pm



var classaInstance=new ClassA('param1');
function test1(){
classaInstance.fun1();
}

function test2(){
classaInstance.fun1();
classaInstance.fun2('param-fun2')
classaInstance.fun1();
}

var ClassB=ClassA.extend({
initialize:function(name,p1,p2){
this.name=name;
this.p1=p1;
this.p2=p2;
},
testExtendFun:function(){
alert(this.name ' ' this.p1 ' ' this.p2);
}
});

ClassB.implement({
testImplementFun:function(){
alert(this.name ' ' this.p1 ' ' this.p2);
}
});

function test3(){
var clb=new ClassB('name1','p1','p2');
alert(clb.p1); //得到的结果为什么是1?
//clb.testExtendFun(); 报错,对象不支持的熟悉
clb.testImplementFun();//得到的结果为什么是 name1,1,2 而不是name1,p1,p2?
}

button

------分隔线----------------------------