function user() { this.age=21; this.name="zhangsan"; this.say=function(){ alert("hello"); } } var u = new user(); alert(u["age"]); alert(u.name); u.say(); [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] JavaScript面向对象的两种书写方法以及差别http://www.jb51.net/article/13211.htmJavaScript 面向对象入门精简篇http://www.jb51.net/article/17541.htm