extjs 登陆代码分析

Ext.onReady(function(){
     Ext.BLANK_IMAGE_URL ="scripts/ext/resources/images/default/s.gif";     
     Ext.QuickTips.init();
     Ext.form.Field.prototype.msgTarget="qtip";
   
      var loginForm = new Ext.FormPanel({
          renderTo:"loginForm",
          id:"loginForm1",   
          width:340,
          height:155, 
          frame:true,
          monitorValid:true,
          items:[ 
               new Ext.form.TextField({ 
               id:"username",
               name:"username",
               fieldLabel:"用 户 名",
               minLength:"6",
               minLengthText:"用户名长度不能小于{0}",
               maxLength:"20",
               maxLengthText:"用户名长度不能大于{0}",
               allowBlank:false,
               blankText:"必须输入用户名"
              }), 
              new Ext.form.TextField({
               id:"password", 
               name:"password",
               fieldLabel:"密  码",
               inputType:"password",
               minLength:"6",
               minLengthText:"密码长度不能小于{0}",
               maxLength:"20",
               maxLengthText:"密码长度不能大于{0}",
               allowBlank:false,
               blankText:"必须输入密码"
              }),
            
              new Ext.form.TextField({
              id:"randCode",
              name:"randCode",
              width:"70",
              fieldLabel:"验证码",
              allowBlank:false,
              blankText:"必须输入验证码"
              })
              ],
          buttons:[
                {text:"登录",formBind:true,handler:function(){
                    loginForm.getForm().submit({
                     url:"bookext.do?method=login",
                     waitMsg:"请稍等,正在登录!",    
                        success:function(form ,action){  
                           // Ext.Msg.alert("用户名",action.result.user);   
                            window.location.href="/MyWebRebuild/bookext.do?method=getUserName";
                        },  
                        failure:function(form , action){      
                            Ext.Msg.alert("提示",action.result.msg);
                        }   
                    });
                    }},        
               
                {text:"重置",handler:function(){
                    loginForm.form.reset();
                    }}
          ]   
          }); 
      
          var rc =Ext.getDom("randcode");
          var rcp =Ext.get(rc.parentNode);
          rcp.createChild({tag:'img',src:'pagesExt/image.jsp',align:'absbottom'});
          var loginWindow = new Ext.Window({
          width:340,
          height:200,
          title:"用户登录",
          items:loginForm,
          draggable:true,
          resizable:false,
          closable:true
          });
          loginWindow.show();
    });

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值