extJS做的一个登录

 

 

 

Ext.onReady(function() {
 Ext.QuickTips.init();
 Ext.form.Field.prototype.msgTarget = "side";
 var simple = new Ext.FormPanel({
  height : 300,
  width : 500,
  defaultType : "textfield",
  labelWidth : 75,
  defaults : {
   width : 100
  },
  baseCls : "x-plane",
  items : [{
   fieldLabel : "用户名",
   name : "name",
   allowBlank : false
   
  }, {
   fieldLabel : "密码",
   name : "password",
   inputType : "password",
   allowBlank : false
  }],
  buttons : [{
   text : "登陆",
   type : "submit",
   // 按钮点击事件
   handler : function() {
    if (simple.form.isValid()) {
     Ext.MessageBox.show({
      title : "请等待....",
      progress : true,
      width : 300
     });
     // 设置延迟加载
     var f = function(v) {
      return function() {
       var i = v / 10;
       Ext.MessageBox.updateProgress(i, '加载中...');
      };
     };
     for (var i = 0; i < 10; i++) {
      setTimeout(f(i), i * 200);
     }
     simple.form.doAction('submit', {
      url : "login.do",//一个Servlet路径  验证使用是否存在
      method : "post",
      params : "param:add",
      success : function(form, action) {
       if (action.result.msg == 'ok') {
        // 加载到首页
        document.location = 'index.jsp';
       } else {
        Ext.MessageBox.alert("信息", action.result.msg);
       }
      }
     });
    }
   }
  }, {
   text : "关闭",
   type : "reset",
   handler : function() {
    // 清除信息
    simple.form.reset();
   }
  }]
 });

 var win = new Ext.Window({
  title : "<center>用户登陆</center>",
  width : 300,
  height : 150,
  bodyStyle : "padding:5px;",
  plane : true,
  layout : "fit",
  closable : false,
  items : simple,
  collapsible : true,// 设置是否可则叠
  expandOnShow : false,
  maximizable : false,// 禁止最大化
  buttonAlign : "center"
 });
 win.show();
 simple.render("show");

});

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值