日期:2014-05-16 浏览次数:20375 次
function Odemo(){} var a=new Odemo(); Odemo.prototype.sayName=function(name) { return this.name=name; } alert(a.sayName('asd')); //显示asd
function Odemo(){} var a=new Odemo(); Odemo.prototype={ name:'asd', sayName:function(){ return this.name; } } alert(a.sayName()); //为什么会报错
function Odemo(){} Odemo.prototype={ name:'asd', sayName:function(){ return this.name; } } var a=new Odemo(); alert(a.sayName()); //显示asd