//=========jsp============ Ext.onReady(function(){ var human = new Ext.yangchunzhi.HumanBeing(); human.name="1102"; human.gender = "无"; human.getData(); }); //=========js============= //定义一个命名空间 Ext.namespace("Ext.yangchunzhi"); //定义一个构造器 Ext.yangchunzhi.HumanBeing =function(){}; //通过原型继承一些属性name,gender,getData(给HumanBeing早绑定一些属性) Ext.apply(Ext.yangchunzhi.HumanBeing.prototype,{ name:'', gender:'', getData:function(){ alert(String.format("姓名:{0},性别:{1},你是:{2}",this.name,this.gender,"大腿")); } })