ExtJs基础UI设计进阶教程(1)

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

了解Ext.Button

  • 说明:该主键代替了传统的submit,reset,button,HTML控件
  • 构造参数:--text:按钮上的名称
  • 属性:-text:获得当前按钮上的名称 -minWindth:按钮的最小宽度
  • 方法:-setText:设置按钮上的名称
  • 事件:-click:当点击按钮是触发

 

button实例

[xhtml] view plain copy
  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 _button = new Ext.Button({  
  15.                     renderTo:document.body,  
  16.                     text:"确 定",  
  17.                     minWidth:100  
  18.             }) ;  
  19.           
  20.     }) ;  
  21.       
  22. // --></mce:script>  
  23. </head>  
  24. <body>  
  25. </body>  
  26. </html>  

 

Ext.Button产生的引申话题

属性:       -renderTO:将当前对象所生成的HTML对象存放进指的的对象中

构造参数    -handler:指定一个函数句柄,在默认事件触发是调用,此时的默认事件为click

-listeners:这个是在对象初始化之前,就将1系列事件进行定义的手段,在进行组件化编程时,特别有用

 

click(handler)实例

[xhtml]  view plain copy
  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.Button({  
  15.                     renderTo:Ext.getBody(),  
  16.                     text:"确 定",  
  17.                     handler:function(){  
  18.                           
  19.                         alert("欢迎你学习EXTJS") ;  
  20.                     }  
  21.             }) ;  
  22.           
  23.     }) ;  
  24.       
  25. // --></mce:script>  
  26. </head>  
  27. <body>  
  28. </body>  
  29. </html>  
 

 

listeners调用(推荐):

[xhtml]  view plain copy
  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.Button({  
  15.                     renderTo:Ext.getBody(),  
  16.                     text:"确 定",  
  17.                     listeners:{  
  18.                           
  19.                         "click":function(){  
  20.                               
  21.                             alert("欢迎你学习EXTJS") ;  
  22.                         }  
  23.                     }  
  24.             }) ;  
  25.           
  26.     }) ;  
  27.       
  28. // --></mce:script>  
  29. </head>  
  30. <body>  
  31. </body>  
  32. </html>  
 

 

传统调用方法(不推荐)

 

 

[xhtml]  view plain copy
  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 _btn = new Ext.Button({  
  15.                     renderTo:Ext.getBody(),  
  16.                     text:"确 定"  
  17.             }) ;  
  18.               
  19.         _btn.on("click" , function(){  
  20.                                   
  21.                                 alert("欢迎你学习EXTJS") ;  
  22.                           }) ;  
  23.           
  24.     }) ;  
  25.       
  26. // --></mce:script>  
  27. </head>  
  28. <body>  
  29. </body>  
  30. </html>  
 

 

了解Ext.form.TextField

 

  • 说明:该组件代替了传统的text组件
  • 属性:-fieldLabel:文本框的标签名称
  • 方法-getValue():得到文本框的值

textfield实例

[xhtml]  view plain copy
  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.form.TextField({  
  15.                 renderTo:Ext.getBody(),  
  16.                 fieldLabel:"姓名"  
  17.             }) ;  
  18.           
  19.     }) ;  
  20.       
  21. // --></mce:script>  
  22. </head>  
  23. <body>  
  24. </body>  
  25. </html>  
 

 

以上这个代码,无法实现textLabel的内容,原因是我们没有使用布局

 

由Ext.form.TextField产生的引申话题

 

  • Ext.layout.FormLayout:只有在此布局下才能正确显示文本框的标签名,布局的宿主对象必须是Ext.Container或者Ext.Container的子类
  • 在应用FormLayout布局时只要在宿主对象的参数中指定layout:"form"即可
  • Ext.getCmp(String_id):的到id为_id的组件对象

布局后实例

[xhtml]  view plain copy
  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>嵌套在具有FormLayout布局特性面板里的文本框</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 _panel = new Ext.Panel({  
  15.                         renderTo:Ext.getBody(),  
  16.                         layout:"form",  
  17.                         labelWidth:30,  
  18.                         listeners:{  
  19.                             "render":function(_panel){  
  20.                                         _panel.add(new Ext.form.TextField({  
  21.                                                     id:"txt_name",  
  22.                                                     fieldLabel:"姓名"  
  23.                                                 })) ;  
  24.                                      }  
  25.                         }}) ;  
  26.                           
  27.                           
  28.           
  29.         new Ext.Button({  
  30.                 text:"确 定",  
  31.                 renderTo:Ext.getBody(),  
  32.                 handler:function(){  
  33.                               
  34.                             alert(Ext.getCmp("txt_name").getValue()) ;  
  35.                         }  
  36.             }) ;  
  37.           
  38.     }) ;  
  39.       
  40. // --></mce:script>  
  41. </head>  
  42. <body>  
  43. </body>  
  44. </html>  
 

 

 

了解Ext.Panel

 

  • 说明:从某种意义来讲,其彻底改变了网页界面是通过HTML Table进行布局的历史
  • 属性:-title:面板的标签名 -width :指定版面的宽度 -height:指定版面的高度 -frame 把4个脚变圆角,改变背景色
  • 方法:-addButton(String/Object_config,Function_handler,Object_scope)添加一个按钮对象到面板中

panel基础实例

[xhtml]  view plain copy
  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.Panel({  
  15.                 renderTo:Ext.getBody(),  
  16.                 title:"人员信息"  
  17.             }) ;  
  18.           
  19.     }) ;  
  20.       
  21. // --></mce:script>  
  22. </head>  
  23. <body>  
  24. </body>  
  25. </html>  
 

 

panel实例(2)

 

[xhtml]  view plain copy
  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.Panel({  
  15.                 renderTo:Ext.getBody(),  
  16.                 title:"人员信息",  
  17.                 width:200,  
  18.                 height:300  
  19.             }) ;  
  20.           
  21.     }) ;  
  22.       
  23. // --></mce:script>  
  24. </head>  
  25. <body>  
  26. </body>  
  27. </html>  
 

 

 

addButton实例:

 

[xhtml]  view plain copy
  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 _panel = new Ext.Panel({  
  15.                 title:"人员信息",  
  16.                 frame:true,  
  17.                 width:200,  
  18.                 height:300  
  19.             }) ;  
  20.               
  21.         _panel.addButton({text:"确 定"}) ;  
  22.                                   
  23.         _panel.addButton(new Ext.Button({text:"取 消"})) ;  
  24.           
  25.         _panel.render(Ext.getBody()) ;  
  26.           
  27.     }) ;  
  28.       
  29. // --></mce:script>  
  30. </head>  
  31. <body>  
  32. </body>  
  33. </html>  
 

 

 

 

 

panel居中(定位)

[xhtml]  view plain copy
  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:style type="text/css"><!--  
  8. .contain{  
  9.         width:100%;   
  10.         height:100%;  
  11.         top:0;  
  12.         left:0;  
  13.     }  
  14. .center {  
  15.     position:absolute;  
  16.     top:30%;  
  17.     left:43%;  
  18.     text-align:left;  
  19. }  
  20. --></mce:style><style type="text/css" mce_bogus="1">.contain{  
  21.         width:100%;   
  22.         height:100%;  
  23.         top:0;  
  24.         left:0;  
  25.     }  
  26. .center {  
  27.     position:absolute;  
  28.     top:30%;  
  29.     left:43%;  
  30.     text-align:left;  
  31. }</style>  
  32. <mce:script type="text/javascript" src="../../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  33. <mce:script type="text/javascript" src="../../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  34. <mce:script type="text/javascript" src="../../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  35. <mce:script type="text/javascript"><!--  
  36.       
  37.     Ext.onReady(function(){  
  38.       
  39.         var _panel = new Ext.Panel({  
  40.                 title:"人员信息",  
  41.                 frame:true,  
  42.                 width:200,  
  43.                 height:300  
  44.             }) ;  
  45.               
  46.         _panel.addButton({text:"确 定"}) ;  
  47.                                   
  48.         _panel.addButton(new Ext.Button({text:"取 消" , minWidth:100})) ;  
  49.           
  50.         _panel.applyToMarkup(Ext.DomHelper.append(Ext.getBody(), {  
  51.                             tag:"div",  
  52.                             cls:"contain",  
  53.                             cn:[{  
  54.                                 tag:"div",  
  55.                                 cls:"center"  
  56.                             }]  
  57.                       } , true).child("div")) ;  
  58.           
  59.     }) ;  
  60.       
  61. // --></mce:script>  
  62. </head>  
  63. <body>  
  64. </body>  
  65. </html>  
 

 

 

2个textfield

[xhtml]  view plain copy
  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 _panel = new Ext.Panel({  
  15.                 title:"人员信息",  
  16.                 frame:true,  
  17.                 width:300,  
  18.                 height:200,  
  19.                 layout:"form",  
  20.                 listeners:{  
  21.                     "render":function(_panel){  
  22.                                   
  23.                                 _panel.add({xtype:"textfield" , fieldLabel:"姓名"}) ;  
  24.                                   
  25.                                 _panel.add(new Ext.form.TextField({  
  26.                                                       
  27.                                                     fieldLabel:"地址"  
  28.                                                       
  29.                                                 })) ;  
  30.                              }  
  31.                 }  
  32.             }) ;  
  33.               
  34.         _panel.addButton({text:"确 定"}) ;  
  35.                                   
  36.         _panel.addButton(new Ext.Button({text:"取 消" , minWidth:100})) ;  
  37.           
  38.         _panel.render(Ext.getBody()) ;  
  39.           
  40.     }) ;  
  41.       
  42. // --></mce:script>  
  43. </head>  
  44. <body>  
  45. </body>  
  46. </html>  
 

 

 

登陆界面:

[xhtml]  view plain copy
  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:style type="text/css"><!--  
  8. .contain{  
  9.         width:100%;   
  10.         height:100%;  
  11.         top:0;  
  12.         left:0;  
  13.     }  
  14. .center {  
  15.     position:absolute;  
  16.     top:30%;  
  17.     left:43%;  
  18.     text-align:left;  
  19. }  
  20. --></mce:style><style type="text/css" mce_bogus="1">.contain{  
  21.         width:100%;   
  22.         height:100%;  
  23.         top:0;  
  24.         left:0;  
  25.     }  
  26. .center {  
  27.     position:absolute;  
  28.     top:30%;  
  29.     left:43%;  
  30.     text-align:left;  
  31. }</style>  
  32. <mce:script type="text/javascript" src="../../../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  33. <mce:script type="text/javascript" src="../../../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  34. <mce:script type="text/javascript" src="../../../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  35. <mce:script type="text/javascript"><!--  
  36.       
  37.     Ext.onReady(function(){  
  38.       
  39.         var _panel = new Ext.Panel({  
  40.                 title:"登 陆",  
  41.                 frame:true,  
  42.                 width:260,  
  43.                 height:130,  
  44.                 layout:"form",  
  45.                 labelWidth:45,  
  46.                 listeners:{  
  47.                     "render":function(_panel){  
  48.                                   
  49.                                 _panel.add({xtype:"textfield" , fieldLabel:"账号" , width:180}) ;  
  50.                                   
  51.                                 _panel.add({xtype:"textfield" , fieldLabel:"密码" , width:180}) ;  
  52.                              }  
  53.                 }  
  54.             }) ;  
  55.               
  56.         _panel.addButton({text:"确 定"}) ;  
  57.                                   
  58.         _panel.addButton({text:"取 消"}) ;  
  59.           
  60.         _panel.applyToMarkup(Ext.DomHelper.append(Ext.getBody(), {  
  61.                             tag:"div",  
  62.                             cls:"contain",  
  63.                             cn:[{  
  64.                                 tag:"div",  
  65.                                 cls:"center"  
  66.                             }]  
  67.                       } , true).child("div")) ;  
  68.           
  69.     }) ;  
  70.       
  71. // --></mce:script>  
  72. </head>  
  73. <body>  
  74. </body>  
  75. </html>  
 

以上全是Ext2.0以下版本的写法,写起来很麻烦

 

2.2版本的登陆界面

[xhtml]  view plain copy
  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:style type="text/css"><!--  
  8. .contain{  
  9.         width:100%;   
  10.         height:100%;  
  11.         top:0;  
  12.         left:0;  
  13.     }  
  14. .center {  
  15.     position:absolute;  
  16.     top:30%;  
  17.     left:43%;  
  18.     text-align:left;  
  19. }  
  20. --></mce:style><style type="text/css" mce_bogus="1">.contain{  
  21.         width:100%;   
  22.         height:100%;  
  23.         top:0;  
  24.         left:0;  
  25.     }  
  26. .center {  
  27.     position:absolute;  
  28.     top:30%;  
  29.     left:43%;  
  30.     text-align:left;  
  31. }</style>  
  32. <mce:script type="text/javascript" src="../../../../adapter/ext/ext-base.js" mce_src="adapter/ext/ext-base.js"></mce:script>  
  33. <mce:script type="text/javascript" src="../../../../ext-all.js" mce_src="ext-all.js"></mce:script>  
  34. <mce:script type="text/javascript" src="../../../../build/locale/ext-lang-zh_CN.js" mce_src="build/locale/ext-lang-zh_CN.js"></mce:script>  
  35. <mce:script type="text/javascript"><!--  
  36.       
  37.     Ext.onReady(function(){  
  38.       
  39.         var _panel = new Ext.Panel({  
  40.                 title:"登 陆",  
  41.                 frame:true,  
  42.                 width:260,  
  43.                 height:130,  
  44.                 layout:"form",  
  45.                 labelWidth:45,  
  46.                 defaults:{xtype:"textfield" , width:180},  
  47.                 items:[{  
  48.                     fieldLabel:"账号"  
  49.                 },{  
  50.                     fieldLabel:"密码"  
  51.                 }],  
  52.                 buttons:[{  
  53.                     text:"确 定"  
  54.                 },{  
  55.                     text:"取 消"  
  56.                 }]  
  57.             }) ;  
  58.           
  59.         _panel.applyToMarkup(Ext.DomHelper.append(Ext.getBody(), {  
  60.                             tag:"div",  
  61.                             cls:"contain",  
  62.                             cn:[{  
  63.                                 tag:"div",  
  64.                                 cls:"center"  
  65.                             }]  
  66.                       } , true).child("div")) ;  
  67.           
  68.     }) ;  
  69.       
  70. // --></mce:script>  
  71. </head>  
  72. <body>  
  73. </body>  
  74. </html>  
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值