标签:style blog http color io java sp div on
<!DOCTYPE html> <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("Sally","Rally",48,"green"); myMother.changeName("Doe"); document.write(myMother.lastname); </script> </body> </html>
来源:http://www.w3cschool.cc/js/js-objects.html
有一句不明白呀~为什么要this.changeName=changeName呢?是函数指针的意思么?
标签:style blog http color io java sp div on
原文地址:http://www.cnblogs.com/jin-wen-xin/p/4022163.html