#32001/2/13 15:39:43
可以的,但是很不爽:
1.先定义构造函数:
function person(name,sex,age){
this.name = name;
this.sex = sex;
this.age = age;
}
2.定义方法:
person.prototype.mm = function (){
xxxxxxxxxxxxxxxxxxxxxxxx
}
或者在定义构造函数时:
function person(name,sex,age){
this.name = name;
this.sex = sex;
this.age = age;
this.mm = function (){
xxxxxxxxxxxxxxxxxxxxxxxx
}
}
3.实体化类
var myperson = new person("Semon","M","100");
不爽吧
编辑历史:[这消息被semon编辑过(编辑时间2001-02-13 15:46:41)]