Ext2.2用户名和密码登录表单的例子
系统
2166 0
这个表单也是我使用中的一个东西。感觉还不错。
先看运行效果
看代码
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
-
<
head
>
-
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"resources/css/ext-all.css"
/>
-
<
script
type
=
"text/javascript"
src
=
"adapter/prototype/prototype.js"
>
</
script
>
-
<
script
type
=
"text/javascript"
src
=
"adapter/prototype/scriptaculous.js?load=effects"
>
</
script
>
-
<
script
type
=
"text/javascript"
src
=
"adapter/prototype/ext-prototype-adapter.js"
>
</
script
>
-
<
script
type
=
"text/javascript"
src
=
"ext-all.js"
>
</
script
>
-
<
style
type
=
"text/css"
>
-
#LOGIN_FORM_LAYER {
-
position:relative;
-
top:150px;
-
width: 965px;
-
height: 551px;
-
}
-
#loginDIV {
-
width:500px;
-
position:relative;
-
top:100px;
-
}
-
</
style
>
-
</
head
>
-
<
body
>
-
<
center
>
-
<
script
type
=
"text/javascript"
>
-
Ext.onReady(function(){
-
-
Ext.QuickTips.init();
-
-
// turn on validation errors beside the field globally
-
Ext.form.Field.prototype.msgTarget
=
'side'
;
-
-
var
bd
=
Ext
.getBody();
-
-
/*
-
* ================ Simple
form
=======================
-
*/
-
//bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});
-
-
-
var
simple
=
new
Ext.FormPanel({
-
id: 'LOGIN_FORM',
-
labelWidth: 75, // label settings here cascade unless overridden
-
url:'login.jsp',
-
frame:true,
-
title: '
<
font
size
=
3
>
登录系统
</
font
>
',
-
bodyStyle:'padding:5px 5px 0',
-
width: 350,
-
defaults: {width: 230},
-
defaultType: 'textfield',
-
ctCls: 'font-size:12px',
-
-
items: [{
-
fieldLabel: '用户名',
-
name: 'username',
-
allowBlank:false
-
},{
-
fieldLabel: '密码',
-
name: 'password',
-
inputType :'password'
-
},new Ext.form.Hidden({
-
name:'referer',
-
value:'/index'
-
})
-
],
-
-
buttons: [{
-
id: 'submitButton',
-
type: 'submit',
-
text: '登录',
-
tooltip: '点击这个按钮登录系统',
-
handler: login
-
}]
-
});
-
simple.render("loginDIV");
-
});
-
function login(){
-
Ext.Ajax.request({
-
url: '/login',
-
form: 'LOGIN_FORM',
-
success: function(t){
-
alert(t.responseText);
-
}
-
});
-
}
-
</
script
>
-
<
div
id
=
"LOGIN_FORM_LAYER"
>
-
<
div
id
=
"loginDIV"
>
</
div
>
-
</
div
>
-
</
center
>
-
</
body
>
-
</
html
>
-
其中的/login处理登录的代码我就不写了。大家自己做吧。
Ext2.2用户名和密码登录表单的例子
更多文章、技术交流、商务合作、联系博主
微信扫码或搜索:z360901061
微信扫一扫加我为好友
QQ号联系: 360901061
您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。
【本文对您有帮助就好】元