阅读:5612回复:0
JavaScript 对象<!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("Steve","Jobs",56,"green"); myMother.changeName("Ballmer"); document.write(myMother.lastname); </script> </body> </html>结果: Ballmer |
|