时间:2021-07-01 10:21:17 帮助过:3人阅读
function W(){
this.name="Wang Hongjian";
this.gender="male";
}
W.prototype.sayHi=function(){
alert("Hello,everybody\nMy name is " + this.name);
return this;
};
W.prototype.doSomething=function(){
alert("I'm working");
return this;
}
W.prototype.sayGoodbye=function(){
alert("Goodbye,everybody");
return this;
};
var w=new W();
w.sayHi().doSomething().sayGoodbye();
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]