Home > Web Front-end > JS Tutorial > body text

JS small practice code_javascript skills

WBOY
Release: 2016-05-16 18:59:53
Original
979 people have browsed it

There is no html code, only JS code. The small exercises are as follows: (Learned from teacher Chen Zhiwen’s course)
<script> <BR>Ext.onReady(function(){ <BR>// Ext.Msg.alert("系统提示(thtwinj2ee)","环境配置正确!") ; <BR>var myPosition = Ext.data.Record.create( <BR>[{name:"position"}] <BR>) ;//返回一个function <BR>new Ext.Window({ <BR>title:"测试用窗口(绝不裸奔)", <BR>width:550, <BR>height:370, <BR>labelWidth:70, <BR>plain:true , <BR>layout:"form", <BR>defaults:{anchor:"95%"}, <BR>// buttonAlign:"center", <BR>items: <BR>[ <BR>{ <BR>layout:"column", <BR>baseCls:"x-plain", <BR>style:"padding:8px", <BR>items: <BR>[ <BR>{ <BR>columnWidth:.5, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>labelWidth:70, <BR>defaults:{width:150}, <BR>defaultType:"textfield", <BR>items: <BR>[ <BR>{ <BR>fieldLabel:"姓名" <BR>}, <BR>{ <BR>fieldLabel:"年龄", <BR>value:23, <BR>readOnly:true <BR>}, <BR>{ <BR>xtype:"datefield", <BR>format:"Y-m-d", <BR>value:"1986-11-16", <BR>readOnly:true, <BR>fieldLabel:"出生日期", <BR>listeners: <BR>{ <BR>"blur":function(_df) <BR>{ <BR>var _age = _df.ownerCt.findByType("textfield")[1] ; <BR>_age.setValue(new Date().getFullYear() - _df.getValue().getFullYear() + 1) ; <BR>} <BR>} <BR>}, <BR>{ <BR>fieldLabel:"联系电话" <BR>}, <BR>{ <BR>fieldLabel:"手机号码" <BR>}, <BR>{ <BR>fieldLabel:"电子邮件" <BR>}, <BR>{ <BR>xtype:"combo", <BR>fieldLabel:"性别", <BR>readOnly:true, <BR>displayField:"sex", <BR>value:"男", <BR>triggerAction:"all", <BR>mode:"local", <BR>store:new Ext.data.SimpleStore <BR>( <BR>{ <BR>fields:["sex"], <BR>data:[["男"],["女"]] <BR>} <BR>) <BR>} <BR>] <BR>}, <BR>{ <BR>columnWidth:.5, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>labelWidth:55, <BR>items: <BR>[ <BR>{ <BR>xtype:"textfield", <BR>width:185, <BR>height:178, <BR>fieldLabel:"个人头像", <BR>inputType:"image" <BR>} <BR>] <BR>} <BR>] <BR>}, <BR>{ <BR>layout:"form", <BR>baseCls:"x-plain", <BR>style:"padding:2px,8px,8px,8px", <BR>defaultType:"textfield", <BR>labelWidth:71, <BR>items: <BR>[ <BR>{ <BR>fieldLabel:"身份证号码", <BR>width:415 <BR>}, <BR>{ <BR>fieldLabel:"具体住址", <BR>width:415 <BR>} <BR>] <BR>}, <BR>{ <BR>layout:"column", <BR>baseCls:"x-plain", <BR>style:"padding:2px,8px,8px,8px", <BR>items: <BR>[ <BR>{ <BR>columnWidth:.4, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>labelWidth:70, <BR>items: <BR>[ <BR>{ <BR>xtype:"combo", <BR>readOnly:true, <BR>mode:"local", <BR>triggerAction:"all", <BR>displayField:"position", <BR>width:100, <BR>fieldLabel:"职称", <BR>value:"初级程序员", <BR>store:new Ext.data.SimpleStore <BR>( <BR>{ <BR>fields:["position"], <BR>data:[["中级程序员"],["高级程序员"],["项目经理"]] <BR>} <BR>) <BR>} <BR>] <BR>}, <BR>{ <BR>columnWidth:.2, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>items: <BR>[ <BR>{ <BR>xtype:"button", <BR>text:"添加职位", <BR>handler:function() <BR>{ <BR>var _window = this.ownerCt.ownerCt.ownerCt ; <BR>var _position = _window.findByType("combo")[1] ; <BR>Ext.Msg.prompt <BR>( <BR>"添加职位", <BR>"请输入将要添加的职位内容", <BR>function(_btn,_text) <BR>{ <BR>if(_btn == "ok") <BR>{ <BR>var _store = this.store ; <BR>_store.insert(0,new myPosition({position:_text})) ; <BR>this.setValue(_text) ; <BR>} <BR>}, _position //用来代替前面function()中的this对象 <BR>); <BR>} <BR>} <BR>] <BR>}, <BR>{ <BR>columnWidth:.2, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>items: <BR>[ <BR>{ <BR>xtype:"button", <BR>text:"修改职位", <BR>handler:function() <BR>{ <BR>var _window = this.ownerCt.ownerCt.ownerCt ; <BR>var _position = _window.findByType("combo")[1] ; <BR>Ext.Msg.prompt( <BR>"修改职位(绝不裸奔)", <BR>"请输入你将要修改的内容:", <BR>function(_btn,_text) <BR>{ <BR>if(_btn == "ok") <BR>{ <BR>this.setValue(_text) ; <BR>} <BR>}, <BR>_position, <BR>false, <BR>_position.getValue() <BR>) ; <BR>} <BR>} <BR>] <BR>}, <BR>{ <BR>columnWidth:.2, <BR>layout:"form", <BR>baseCls:"x-plain", <BR>items: <BR>[ <BR>{ <BR>xtype:"button", <BR>text:"删除职位", <BR>handler:function() <BR>{ <BR>var _window = this.ownerCt.ownerCt.ownerCt ; <BR>var _position = _window.findByType("combo")[1] ; <BR>Ext.Msg.confirm <BR>( <BR>"警告(thtwinj2ee)", <BR>"你真的要删除该项内容吗?", <BR>function(_btn) <BR>{ <BR>if(_btn == "yes") <BR>{ <BR>this.store.remove(this["selectItem"]) ; <BR>if(this.store.getCount() != 0) <BR>{ <BR>this.setValue(this.store.getAt(0).get("position")) ; <BR>this["selectItem"] = this.store.getAt(0).get("position") ; <BR>} <BR>} <BR>}, <BR>_position <BR>) ; <BR>} <BR>} <BR>] <BR>} <BR>] <BR>} <BR>], <BR>listeners: <BR>{ <BR>"show":function(_window) <BR>{ <BR>_window.findByType("textfield")[5].getEl().dom.src = "02.jpg" ; <BR>} <BR>}, <BR>buttons: <BR>[ <BR>{ <BR>text:"确定" <BR>}, <BR>{ <BR>text:"取消" <BR>} <BR>] <BR>}).show() ; <BR>}) ; <BR></script>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!