//=============jsp======
Ext.onReady(function(){
Ext.yangchunzhi.HumanBeing.Money("www","yoyo");
});
//===========js=========
//定义一个命名空间
Ext.namespace("Ext.yangchunzhi");
//定义一个构造器
Ext.yangchunzhi.HumanBeing =function(cfg){
Ext.apply(this,cfg)
};
Ext.yangchunzhi.HumanBeing.Money = function(_name,_gender){
var cfg = {name:_name,gender:_gender};
var h = new Ext.yangchunzhi.HumanBeing(cfg);
h.getData();
}
Ext.apply(Ext.yangchunzhi.HumanBeing.prototype,{
getData:function(){
alert(String.format("姓名:{0},性别:{1},大家都是:{2}",this.name,this.gender,"大腿"));
}
})
costructor extend
最新推荐文章于 2025-05-25 17:14:18 发布
本文介绍了如何使用JavaScript创建并操作一个命名空间Ext.yangchunzhi下的HumanBeing对象实例,通过传入参数来获取对象的姓名、性别,并在控制台输出相关信息。
3048

被折叠的 条评论
为什么被折叠?



