首页 »Javascript教程 » js代码:JS的小练习代码 »正文js代码:JS的小练习代码来源: 发布时间:星期四, 2008年12月25日 浏览:124次 评论:0
没有html代码,只有JS代码,小练习内容如下:(从陈治文老师课程中学到)
<script> Ext.onReady(function{ // Ext.Msg.alert("系统提示(thtwinj2ee)","环境配置正确!") ; var myPosition = Ext.data.Record.create( [{name:"position"}] ) ;//返回个function Ext.Window({ title:"测试用窗口(绝不裸奔)", width:550, height:370, labelWidth:70, plain:true , layout:"form", defaults:{anchor:"95%"}, // buttonAlign:"center", items: [ { layout:"column", baseCls:"x-plain", style:"padding:8px", items: [ { columnWidth:.5, layout:"form", baseCls:"x-plain", labelWidth:70, defaults:{width:150}, defaultType:"textfield", items: [ { fieldLabel:"姓名" }, { fieldLabel:"年龄", value:23, readOnly:true }, { xtype:"datefield", format:"Y-m-d", value:"1986-11-16", readOnly:true, fieldLabel:"出生日期", listeners: { "blur":function(_df) { var _age = _df.ownerCt.findByType("textfield")[1] ; _age.Value( Date.getFullYear - _df.getValue.getFullYear + 1) ; } } }, { fieldLabel:"联系电话" }, { fieldLabel:"手机号码" }, { fieldLabel:"电子邮件" }, { xtype:"combo", fieldLabel:"性别", readOnly:true, displayField:"sex", value:"男", triggerAction:"all", mode:"local", store: Ext.data.SimpleStore ( { fields:["sex"], data:[["男"],["女"]] } ) } ] }, { columnWidth:.5, layout:"form", baseCls:"x-plain", labelWidth:55, items: [ { xtype:"textfield", width:185, height:178, fieldLabel:"个人头像", inputType:"image" } ] } ] }, { layout:"form", baseCls:"x-plain", style:"padding:2px,8px,8px,8px", defaultType:"textfield", labelWidth:71, items: [ { fieldLabel:"身份证号码", width:415 }, { fieldLabel:"具体住址", width:415 } ] }, { layout:"column", baseCls:"x-plain", style:"padding:2px,8px,8px,8px", items: [ { columnWidth:.4, layout:"form", baseCls:"x-plain", labelWidth:70, items: [ { xtype:"combo", readOnly:true, mode:"local", triggerAction:"all", displayField:"position", width:100, fieldLabel:"职称", value:"初级员", store: Ext.data.SimpleStore ( { fields:["position"], data:[["中级员"],["高级员"],["项目经理(project manager)"]] } ) } ] }, { columnWidth:.2, layout:"form", baseCls:"x-plain", items: [ { xtype:"button", text:"添加职位", handler:function { var _window = this.ownerCt.ownerCt.ownerCt ; var _position = _window.findByType("combo")[1] ; Ext.Msg.prompt ( "添加职位", "请输入将要添加职位内容", function(_btn,_text) { (_btn "ok") { var _store = this.store ; _store.insert(0, myPosition({position:_text})) ; this.Value(_text) ; } }, _position //用来代替前面function中this对象 ); } } ] }, { columnWidth:.2, layout:"form", baseCls:"x-plain", items: [ { xtype:"button", text:"修改职位", handler:function { var _window = this.ownerCt.ownerCt.ownerCt ; var _position = _window.findByType("combo")[1] ; Ext.Msg.prompt( "修改职位(绝不裸奔)", "请输入你将要修改内容:", function(_btn,_text) { (_btn "ok") { this.Value(_text) ; } }, _position, false, _position.getValue ) ; } } ] }, { columnWidth:.2, layout:"form", baseCls:"x-plain", items: [ { xtype:"button", text:"删除职位", handler:function { var _window = this.ownerCt.ownerCt.ownerCt ; var _position = _window.findByType("combo")[1] ; Ext.Msg.confirm ( "警告(thtwinj2ee)", "你真要删除该项内容吗?", function(_btn) { (_btn "yes") { this.store.remove(this["selectItem"]) ; (this.store.getCount != 0) { this.Value(this.store.getAt(0).get("position")) ; this["selectItem"] = this.store.getAt(0).get("position") ; } } }, _position ) ; } } ] } ] } ], listeners: { "show":function(_window) { _window.findByType("textfield")[5].getEl.dom.src = "02.jpg" ; } }, buttons: [ { text:"确定" }, { text:"取消" } ] }).show ; }) ; </script> 0
相关文章读者评论发表评论 |