EXTJS初级UI设计进阶教程(3)

来源:互联网 发布:python 隐马尔可夫模型 编辑:程序博客网 时间:2024/06/09 23:02

转自:http://blog.csdn.net/yu624774720hua/article/details/6556864

初级login.html

[xhtml] view plaincopy
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  5. <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" mce_href="resources/css/ext-all.css" />  
  6. <title>注册</title>  
  7. <mce:script type="text/javascript" src="../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  8. <mce:script type="text/javascript" src="../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  9. <mce:script type="text/javascript" src="../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  10. <mce:script type="text/javascript"><!--  
  11.       
  12.     Ext.onReady(function(){  
  13.       
  14.         new Ext.Window({  
  15.                 title:"添加人员",  
  16.                 width:500,  
  17.                 height:350,  
  18.                 plain:true,  
  19.                 layout:"form",  
  20.                 labelWidth:59,  
  21.                 defaultType:"textfield",  
  22.                 items:[{  
  23.                     xtype:"panel",  
  24.                     baseCls:"x-plain",  
  25.                     style:"padding:5px",  
  26.                     layout:"column",  
  27.                     items:[{  
  28.                         columnWidth:.5,  
  29.                         layout:"form",  
  30.                         labelWidth:55,  
  31.                         defaultType:"textfield",  
  32.                         defaults:{width:160},  
  33.                         baseCls:"x-plain",  
  34.                         items:[{  
  35.                             fieldLabel:"姓名"  
  36.                         },{  
  37.                             fieldLabel:"年龄"  
  38.                         },{  
  39.                             fieldLabel:"出生日期"  
  40.                         },{  
  41.                             fieldLabel:"联系电话"  
  42.                         },{  
  43.                             fieldLabel:"手机号码"  
  44.                         },{  
  45.                             fieldLabel:"电子邮件"  
  46.                         },{  
  47.                             fieldLabel:"性别"  
  48.                         }]  
  49.                     },{  
  50.                         columnWidth:.5,  
  51.                         layout:"form",  
  52.                         labelWidth:55,  
  53.                         baseCls:"x-plain",  
  54.                         items:{  
  55.                             xtype:"textfield",  
  56.                             fieldLabel:"个人照片",  
  57.                             width:170,  
  58.                             height:177,  
  59.                             inputType:"image"  
  60.                         }  
  61.                     }]  
  62.                 },{  
  63.                     fieldLabel:"身份证号",  
  64.                     width:400  
  65.                 },{  
  66.                     fieldLabel:"具体地址",  
  67.                     width:400  
  68.                 },{  
  69.                     fieldLabel:"职位"  
  70.                 }],  
  71.                 showLock:false,  
  72.                 listeners:{  
  73.                     "show":function(_window){  
  74.                                       
  75.                                     if(!_window["showLock"]){  
  76.                                       
  77.                                         _window.findByType("textfield")[7].getEl().dom.src = "default_pic.gif" ;  
  78.                                           
  79.                                         _window["showLock"] = true;  
  80.                                       
  81.                                     }  
  82.                              }  
  83.                 },  
  84.                 buttons:[{  
  85.                     text:"确定",  
  86.                     handler:function(){  
  87.                       
  88.                         alert(this.ownerCt.buttons[1].text) ;  
  89.                       
  90.                     }  
  91.                 },{  
  92.                     text:"取消"  
  93.                 }]  
  94.             }).show() ;  
  95.               
  96.     }) ;  
  97.       
  98. // --></mce:script>  
  99. </head>  
  100. <body>  
  101. </body>  
  102. </html>  
 

 

高级login.html

[javascript] view plaincopy
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  5. <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" mce_href="resources/css/ext-all.css" />  
  6. <title>注册</title>  
  7. <mce:script type="text/javascript" src="../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  8. <mce:script type="text/javascript" src="../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  9. <mce:script type="text/javascript" src="../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  10. <mce:script type="text/javascript"><!--  
  11.       
  12.     Ext.onReady(function(){  
  13.       
  14.         new Ext.Window({  
  15.                 title:"添加人员",  
  16.                 width:510,  
  17.                 height:360,  
  18.                 plain:true,  
  19.                 layout:"form",  
  20.                 labelWidth:59,  
  21.                 defaultType:"textfield",  
  22.                 defaults:{anchor:"95%"},  
  23.                 items:[{  
  24.                     xtype:"panel",  
  25.                     baseCls:"x-plain",  
  26.                     style:"padding:5px",  
  27.                     layout:"column",  
  28.                     items:[{  
  29.                         columnWidth:.5,  
  30.                         layout:"form",  
  31.                         labelWidth:55,  
  32.                         defaultType:"textfield",  
  33.                         defaults:{width:160},  
  34.                         baseCls:"x-plain",  
  35.                         items:[{  
  36.                             fieldLabel:"姓名"  
  37.                         },{  
  38.                             fieldLabel:"年龄",  
  39.                             value:28,  
  40.                             readOnly:true  
  41.                         },{  
  42.                             xtype:"datefield",  
  43.                             format:"Y-m-d",  
  44.                             value:"1981-10-18",  
  45.                             readOnly:true,  
  46.                             fieldLabel:"出生日期",  
  47.                             listeners:{  
  48.                                 "blur":function(_df){  
  49.                                       
  50.                                     var _age = _df.ownerCt.findByType("textfield")[1] ;  
  51.                                       
  52.                                     _age.setValue(new Date().getFullYear() - _df.getValue().getFullYear() + 1) ;  
  53.                                 }  
  54.                             }  
  55.                         },{  
  56.                             fieldLabel:"联系电话"  
  57.                         },{  
  58.                             fieldLabel:"手机号码"  
  59.                         },{  
  60.                             fieldLabel:"电子邮件"  
  61.                         },{  
  62.                             xtype:"combo",  
  63.                             fieldLabel:"性别",  
  64.                             mode :"local",  
  65.                             displayField :"sex",  
  66.                             readOnly:true,  
  67.                             triggerAction : "all",  
  68.                             value:"男",  
  69.                             store:new Ext.data.SimpleStore({  
  70.                                             fields:["sex"],  
  71.                                             data:[["男"] , ["女"]]  
  72.                                       })  
  73.                         }]  
  74.                     },{  
  75.                         columnWidth:.5,  
  76.                         layout:"form",  
  77.                         labelWidth:55,  
  78.                         baseCls:"x-plain",  
  79.                         items:{  
  80.                             xtype:"textfield",  
  81.                             fieldLabel:"个人照片",  
  82.                             width:170,  
  83.                             height:177,  
  84.                             inputType:"image"  
  85.                         }  
  86.                     }]  
  87.                 },{  
  88.                     fieldLabel:"身份证号",  
  89.                     width:400  
  90.                 },{  
  91.                     fieldLabel:"具体地址",  
  92.                     width:400  
  93.                 },{  
  94.                     fieldLabel:"职位"  
  95.                 }],  
  96.                 showLock:false,  
  97.                 listeners:{  
  98.                     "show":function(_window){  
  99.                                       
  100.                                     if(!_window["showLock"]){  
  101.                                       
  102.                                         _window.findByType("textfield")[5].getEl().dom.src = "default_pic.gif" ;  
  103.                                           
  104.                                         _window["showLock"] = true;  
  105.                                       
  106.                                     }  
  107.                              }  
  108.                 },  
  109.                 buttons:[{  
  110.                     text:"确定",  
  111.                     handler:function(){  
  112.                       
  113.                         alert(this.ownerCt.buttons[1].text) ;  
  114.                       
  115.                     }  
  116.                 },{  
  117.                     text:"取消"  
  118.                 }]  
  119.             }).show() ;  
  120.               
  121.     }) ;  
  122.       
  123. // --></mce:script>  
  124. </head>  
  125. <body>  
  126. </body>  
  127. </html>  
 

 

login界面

 

twoTextFieldLoginWindow.html

[xhtml] view plaincopy
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  5. <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" mce_href="resources/css/ext-all.css" />  
  6. <title>登陆窗体</title>  
  7. <mce:script type="text/javascript" src="../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  8. <mce:script type="text/javascript" src="../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  9. <mce:script type="text/javascript" src="../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  10. <mce:script type="text/javascript"><!--  
  11.       
  12.     Ext.onReady(function(){  
  13.       
  14.         var _window = new Ext.Window({  
  15.                             title:"测试窗体",  
  16.                             layout:"form",  
  17.                             width:300,  
  18.                             plain:true,  
  19.                             items:[{  
  20.                                 xtype:"textfield",  
  21.                                 fieldLabel:"姓名"  
  22.                             },{  
  23.                                 xtype:"textfield",  
  24.                                 fieldLabel:"密码"  
  25.                             }],  
  26.                               
  27.                             buttons:[{  
  28.                                 text:"确定",  
  29.                                 handler:function(){  
  30.                                   
  31.                                     var _coll = this.ownerCt.items ;  
  32.                                       
  33.                                     var _temp = "" ;  
  34.                                   
  35.                                     _temp += "姓名是:" + _coll.first().getValue() ;  
  36.                                       
  37.                                     _temp += "密码是:" + _coll.itemAt(1).getValue() ;  
  38.                                       
  39.                                     alert(_temp) ;  
  40.                                   
  41.                                 }  
  42.                             }]  
  43.                       }) ;  
  44.                         
  45.         _window.show() ;  
  46.               
  47.     }) ;  
  48.       
  49. // --></mce:script>  
  50. </head>  
  51. <body>  
  52. </body>  
  53. </html>  
 

原创粉丝点击