首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js新手基础有关问题2

2012-08-13 
js新手基础问题2var Class {create: function () {return function () {this.initialize.apply(this, ar

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 

热点排行
Bad Request.