帮我找找错误?

来源:百度知道 编辑:UC知道 时间:2024/05/29 19:23:52
<script language="javascript">
function person(){}
person.prototype={
name : name,
sex : sex,
id : id,
introduce:function(){
alert("我的名字叫:"+this.name+"\n如果您的视力正常你会看出我的性别是:"+this.sex+"\n我的ID是:"+this.id);}
}
person1=new person("李四","男","073431132");
person1.introduce();
alert(person1.name);
</script>

<script language="javascript">
function person(name,sex,id){
this.name=name;
this.sex=sex;
this.id=id;
}
person.prototype.introduce=function(){
alert("我的名字叫:"+this.name+"\n如果您的视力正常你会看出我的性别是:"+this.sex+"\n我的ID是:"+this.id);
}

var person1 = new person("李四","男","073431132");
person1.introduce();
alert(person1.name);
</script>