Ext2.2用户名和密码登录表单的例子 - 军军小站|张军博客

Ext2.2用户名和密码登录表单的例子

系统 2166 0
这个表单也是我使用中的一个东西。感觉还不错。

先看运行效果
Ext2.2用户名和密码登录表单的例子

看代码
  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. < link   rel = "stylesheet"   type = "text/css"   href = "resources/css/ext-all.css" />
  5. < script   type = "text/javascript"   src = "adapter/prototype/prototype.js" > </ script >
  6. < script   type = "text/javascript"   src = "adapter/prototype/scriptaculous.js?load=effects" > </ script >
  7. < script   type = "text/javascript"   src = "adapter/prototype/ext-prototype-adapter.js" > </ script >
  8. < script   type = "text/javascript"   src = "ext-all.js" > </ script >
  9. < style   type = "text/css" >
  10. #LOGIN_FORM_LAYER {
  11.   position:relative;
  12.   top:150px;
  13.   width: 965px;
  14.   height: 551px;
  15. }
  16. #loginDIV {
  17.   width:500px;
  18.   position:relative;
  19.   top:100px;
  20. }
  21. </ style >
  22. </ head >
  23. < body >
  24. < center >
  25. < script   type = "text/javascript" >
  26. Ext.onReady(function(){
  27.     Ext.QuickTips.init();
  28.     // turn on validation errors beside the field globally
  29.      Ext.form.Field.prototype.msgTarget  =  'side' ;
  30.     var  bd  =  Ext .getBody();
  31.     /*
  32.      * ================  Simple  form   =======================
  33.      */
  34.     //bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});
  35.     var  simple  =  new  Ext.FormPanel({
  36.         id: 'LOGIN_FORM',
  37.         labelWidth: 75, // label settings here cascade unless overridden
  38.         url:'login.jsp',
  39.         frame:true,
  40.         title: ' < font   size = 3 > 登录系统 </ font > ',
  41.         bodyStyle:'padding:5px 5px 0',
  42.         width: 350,
  43.         defaults: {width: 230},
  44.         defaultType: 'textfield',
  45.         ctCls: 'font-size:12px',
  46.         items: [{
  47.                 fieldLabel: '用户名',
  48.                 name: 'username',
  49.                 allowBlank:false
  50.             },{
  51.                 fieldLabel: '密码',
  52.                 name: 'password',
  53.                 inputType :'password'
  54.             },new Ext.form.Hidden({
  55.               name:'referer',
  56.               value:'/index'
  57.             })
  58.         ],
  59.         buttons: [{
  60.             id: 'submitButton',
  61.             type: 'submit',
  62.             text: '登录',
  63.             tooltip: '点击这个按钮登录系统',
  64.             handler: login
  65.         }]
  66.     });
  67.     simple.render("loginDIV");
  68. });
  69. function login(){
  70.   Ext.Ajax.request({
  71.     url: '/login',
  72.     form: 'LOGIN_FORM',
  73.     success: function(t){
  74.       alert(t.responseText);
  75.     }
  76.   });
  77. }
  78. </ script >
  79. < div   id = "LOGIN_FORM_LAYER" >
  80. < div   id = "loginDIV" > </ div >
  81. </ div >
  82. </ center >
  83. </ body >
  84. </ html >

其中的/login处理登录的代码我就不写了。大家自己做吧。

Ext2.2用户名和密码登录表单的例子


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论