<html>
<body>
<script>
function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
this.changeName=changeName;
function changeName(name)
{
this.lastname=name;
}
}
myMother=new person("Steve","Jobs",56,"green");
myMother.changeName("Ballmer");
document.write(myMother.lastname);
</script>
</body>
</html>
这段代码中
this.firstname=firstname;this.lastname=lastname;this.age=age;this.eyecolor=eyecolor;
this.changeName=changeName;这几句是什么意思有什么用,和后面那个函数的关系是什么?
Samaritan
慕前端7352391
相关分类