extjs创建弹窗输入框

来源:互联网 发布:便宜mp3知乎 编辑:程序博客网 时间:2024/06/06 16:32
function changPwd(){  GLOBAL.pwdBox = new Ext.custom.basicWindow({      title:"修改密码",      width:500,      height:340,      bodyPadding:"20",      items:[        {          xtype:"panel",          items:[            new Ext.custom.middletextfield({              itemId:"Pwd",              fieldLabel:"当前密码",              beforeLabelTextTpl:required,              inputType:"password",              margin:"10"            }),            new Ext.custom.middletextfield({              itemId:"newPwd",              fieldLabel:"新的密码",              inputType:"password",              beforeLabelTextTpl:required,              margin:"10"            }),            new Ext.custom.middletextfield({              itemId:"trueId",              fieldLabel:"确认密码",              inputType:"password",              beforeLabelTextTpl:required,              margin:"10"            })          ]        },        {          xtype:"panel",          layout:"hbox",          items:[{            xtype:"button",            width:100,            height:34,            margin:"20 10 0 100",            text:"确定",            style:"background:green;border:none;",            handler:function(){              var oldPwd = GLOBAL.pwdBox.down("#Pwd").getValue(),                newPwd = GLOBAL.pwdBox.down("#newPwd").getValue(),                truePwd =GLOBAL.pwdBox.down("#trueId").getValue()              if(oldPwd==""||newPwd==""||truePwd==""){                Ext.Msg.alert("提示","密码不能为空")              }              else if(oldPwd==newPwd){                Ext.Msg.alert("提示","两次密码不可重复")              }else if(newPwd!=truePwd){                Ext.Msg.alert("提示","新密码不一致")              }else{                $.ajax({                  url:"/Handler/AdminHandler.ashx?action=updatepass",                  type:"post",                  dataType:"json",                  async:false,                  data:{                    userPwd:oldPwd,                    newPwd:newPwd                  }                }).done(function(result){                  if(result.success){                    Ext.Msg.alert("提示",result.success)                    GLOBAL.pwdBox.hide()                  }                  if(result.err){                    Ext.Msg.alert("提示",result.err)                  }                })              }            },          },{            xtype:"button",            width:100,            height:34,            margin:"20 10 0 20",            text:"取消",            handler:function(){              GLOBAL.pwdBox.hide();            },            style:"background:blue;border:none;"          }]        }      ]    }  ).show();}
记得调用

1 0
原创粉丝点击