<script language="javascript">
function Person(){
this.name = "zhangSan";
this.sex = "男";
this.age = 88;
} Person.prototype={
getSex():function(){ //这一行提示缺少:
return this.sex;
},
getAge():function(){
return this.age;
}
};
var obj = new Person();
document.write(obj.getSex());
document.write(obj.getAge()); </script>
function Person(){
this.name = "zhangSan";
this.sex = "男";
this.age = 88;
} Person.prototype={
getSex():function(){ //这一行提示缺少:
return this.sex;
},
getAge():function(){
return this.age;
}
};
var obj = new Person();
document.write(obj.getSex());
document.write(obj.getAge()); </script>
getSex():function(){ //这一行提示缺少:
return this.sex;
},
getAge():function(){
return this.age;
}
};
括号去掉
getSex:function(){
return this.sex;
},
getAge:function(){
return this.age;
}
};