今天EXT中又碰到没接触过的东西:就是怎样处理键盘的触发事件,百度了挺久,后来经师兄指点,到了它的官方论坛一看,没成想原来这么简单:就是加多个keys属性然后在里面定义属性和方法而已,如下
var myform = new Ext.FormPanel({
labelWidth: 75,
title:'双卫网后台登录',
frame:true,
url:'login.html',
width: 340,
method:'POST',
[color=red]keys:[
{
key: [10,13],
fn:surely
}[/color] ],
items: [
mytext,
mypassword,
mytestcode,
{
html:' <img alt="code..." name="randImage" id="randImage" src="image.html" width="60" height="16" border="1" align="absmiddle"><a href="#" onClick="location.reload()" >看不清点我</a>'
}
],
buttons:[
{
text:'确定',
id:'sure',
handler:surely
},
{
text:'重置',
id:'clear',
handler:reset
}]
});
function reset()
{
myform.form.reset();
}
function surely()
{
if(myform.getForm().isValid())
{
myform.getForm().getEl().dom.submit();
}
}
var myform = new Ext.FormPanel({
labelWidth: 75,
title:'双卫网后台登录',
frame:true,
url:'login.html',
width: 340,
method:'POST',
[color=red]keys:[
{
key: [10,13],
fn:surely
}[/color] ],
items: [
mytext,
mypassword,
mytestcode,
{
html:' <img alt="code..." name="randImage" id="randImage" src="image.html" width="60" height="16" border="1" align="absmiddle"><a href="#" onClick="location.reload()" >看不清点我</a>'
}
],
buttons:[
{
text:'确定',
id:'sure',
handler:surely
},
{
text:'重置',
id:'clear',
handler:reset
}]
});
function reset()
{
myform.form.reset();
}
function surely()
{
if(myform.getForm().isValid())
{
myform.getForm().getEl().dom.submit();
}
}