<span id="span_user" οnclick="f_plogin()">登录</span>
function f_plogin(){
var login_form=new Ext.form.FormPanel({
url : path+'/user!plLgin.ec',
labelAlign : 'right',
labelWidth : 100,
bodyStyle : 'padding:5px',
border : false,
baseCls: 'x-plain',
defaults: {width:200,xtype:'textfield',allowBlank:false},
items : [{
fieldLabel:'用户名',name:'username'},{
fieldLabel:'密码',name:'password',inputType:'password'}
]
});
var login_win=new Ext.Window({
closeAction : 'close',
resizable : false,
modal:true,
width:400,
iconCls:'icon-key',
title:'登录',
autoHeight:true,
items:[login_form],
buttons:[{text:'登 录',handler:function(){
if(login_form.getForm().isValid()){
login_form.getForm().submit({
scope : this,
waitTitle:'登录中',
waitMsg : '登录中...',
success : function(form, action) {
//alert('登录成功!');
login_win.close();
location.reload();
},
failure : function(form, action) {
alert('登录失败,用户名或密码错误!');
}
});
}else{
alert('请输入用户名或密码!');
}
}}]
});
login_win.show();
}
需要引入的插件:
<link rel="stylesheet" type="text/css" href="/resources/css/ext-all.css"/>
<script src="/resources/ext-base.js" type="text/javascript"></script>
<script src="/resources/ext-all.js" type="text/javascript"></script>
下载地址:
https://download.csdn.net/download/qq_25391785/10318013