读书人

js新手基础有关问题2

发布时间: 2012-08-13 13:21:53 作者: rapoo

js新手基础问题2
var Class = {
create: function () {
return function () {
this.initialize.apply(this, arguments);
};
}
};
Object.extend = function (a, c) {
for (var b in c) {
a[b] = c[b];
}
return a;
};

var Client = OtherClient;
Client = Class.create();
Object.extend(Client.prototype, {
name: "Hotel",
InDays: 20,
afterDays: 180
});

这种写法是什么意思???

[解决办法]

JScript code
var Class = {            create: function() {                return function() {                    this.initialize.apply(this, arguments);                };            }        };        Object.extend = function(a, c) {            for (var b in c) {                a[b] = c[b];            }            return a;        };                  var Client = Class.create();        Object.extend(Client.prototype, {            name: "Hotel",            InDays: 20,            afterDays: 180        });        alert(Client.prototype.name); //弹出Hotel 

读书人网 >JavaScript

热点推荐