本帖最后由 showshore 于 2011-06-05 22:57:52 编辑

解决方案 »

  1.   

    改成下面这样就可以咯:var person = {};
    person = function(n) {
           this.name = n;
    };
    person.prototype = {
            name: "Scott Allen",     
            createdDate: new Date(),
            website: "OdeToCode.com",
            address: { state: "MD", postalCode: "21044" }
        };function init() {
        var p = new person("me");
        alert(p.name);
    }
      

  2.   

    /*var person = {};
    person = function(n) {
           this.name = n;
    };*/
    var person = function(n) {
          this.name = n;
    };
    这样改一下也行