在下面的函数,用它里面的方法称为newlastname
:在JavaScript中向对象添加方法的说明?
function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
this.newlastname=newlastname;
}
function newlastname(new_lastname)
{
this.lastname=new_lastname;
}
在线路this.newlastname=newlastname;
发生了什么?第一个新名称是指什么?我很欣赏任何提示或建议。
真棒 - 现在点击!非常感谢你! – Coffee 2012-03-31 18:36:40