From: JavaEye.com JavaScript可以不必定义对象类别而直接定义对象实例: var person = { name : "", age : 0, toString: function() { document.writeln("[name]:"+this.name+""+"[age]:"+this.age); } } 完整的HTML例子: JavaScript var person = { name : "", age : 0, toString: function() { document.writeln("[name]:"+this.name+" "+"[age]:"+this.age); } } person.name="robbin"; person.age=30; person.toString(); [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]