Ext2.0:Ext登陆窗口代码 含验证码

Ext登陆窗口代码,关键代码位于 login.js 中

 

html代码:

 

  
  
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.     <head>
  4.         <title>wayfoon</title>
  5.         <meta http-equiv="pragma" content="no-cache">
  6.         <meta http-equiv="cache-control" content="no-cache">
  7.         <meta http-equiv="expires" content="0">
  8.         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  9.         <link rel="stylesheet" type="text/css"
  10.             href="../ext/resources/css/ext-all.css">
  11.         <script type="text/javascript" src="../ext/ext-base.js"></script>
  12.         <script type="text/javascript" src="../ext/ext-all.js"></script>
  13.         <SCRIPT type="text/javascript" src="../js/login.js"></SCRIPT>
  14.         <link rel="stylesheet" type="text/css" href="../ext/resources/css/xtheme-slate.css" />
  15.         <SCRIPT type="text/javascript" src="../ext/ext-lang-zh_CN.js"></SCRIPT>
  16.         <script type="text/javascript">
  17.         Ext.onReady(function()
  18.         {
  19.             Ext.MessageBox.alert('haha','o(∩_∩)o...哈哈');
  20.         })
  21.         </script>
  22.     </head>
  23.     <body>
  24.     </body>
  25. </html>

 

login.js 代码:

 

  1. Ext.onReady(function() {
  2.     // 开启表单提示
  3.     Ext.QuickTips.init();
  4.     // 设置提示信息位置为边上
  5.     Ext.form.Field.prototype.msgTarget = 'side';
  6.     var win = new Ext.Window({
  7.         id : 'login-win',
  8.         title : '登陆',
  9.         iconCls : 'tabs',
  10.         width : 300,
  11.         height : 120,
  12.         collapsible : true,
  13.         plain : true,
  14.         // 初始化表单面板
  15.         items : new Ext.form.FormPanel({
  16.             id : 'login-form',
  17.             labelWidth : 50, // 默认标签宽度板
  18.             labelAlign : 'right',
  19.             buttonAlign : 'center',
  20.             // 不设置该值,表单将保持原样,设置后表单与窗体完全融合
  21.             baseCls : 'header',
  22.             layout : 'form',
  23.             defaults : {
  24.                 width : 200
  25.             },
  26.             // 默认字段类型
  27.             defaultType : 'textfield',
  28.             items : [{
  29.                 id : 'username',
  30.                 fieldLabel : '账号',
  31.                 allowBlank : false
  32.                     // 禁止为空
  33.                     }, {
  34.                         id : 'password',
  35.                         inputType : 'password',
  36.                         fieldLabel : '密码',
  37.                         allowBlank : false
  38.                     }],
  39.             // 初始化按钮
  40.             buttons : [{
  41.                 text : '登陆',
  42.                 type : 'submit',
  43.                 handler : function() {
  44.                     var but = this;
  45.                     but.setDisabled(true);
  46.                     this.setText('正在登陆');
  47.                     // 将表单提交
  48.                     Ext.getCmp('login-form').getForm().submit({
  49.                         url : '/XXX/login.action',
  50.                         method : "POST",
  51.                         success : function(form, action) {
  52.                             document.location = '/XXX/main.jsp';
  53.                         },
  54.                         failure : function() {
  55.                             but.setText("登陆");
  56.                             but.setDisabled(false);
  57.                         }
  58.                     });
  59.                 }
  60.             }]
  61.         })
  62.     });
  63.     // 将窗口显示出来
  64.     win.show();
  65. });

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值