日期:2014-05-16 浏览次数:20283 次
/**method 声明**/ function Object1(name) { this.name = name; this.fun1 = function(){ alert("this is first method !"); }; this.fun2 = function() { alert("this is second method !"); }; } function Object2(name) { Object1.apply(this,[name]); //Object1.apply(this,["hahahhah"]); } /**method 调用**/ var o2 = new Object2("china"); o2.fun1(); //alert("this is first method!"); o2.fun2(); //alert("this is second method!"); alert(o2.name+"==================apply method!");//alert(china=============apply method!);