如果用户在输入密码时打开大写锁定,我想添加一条消息.到目前为止,这是我尝试过的.
{
xtype:'textfield',itemId: 'field_password_login',fieldLabel: 'Password',inputType: 'password',allowBlank: false,listeners:
{
keypress: function(tf,e)
{
if (e.getKey() != 13 && e.getKey() != 10 && e.getKey() != 127)
{
if ((!e.shiftKey && (e.getKey() >= 65 && e.getKey() <= 90)) || ((e.getKey() >= 97 && e.getKey() <= 122) && e.shiftKey))
{
Ext.getCmp("app_idCAPSIndicator").setText("CAPS LOCK is ON");
Ext.getDom("app_idCAPSIndicator").style.color = "navy";
}
else
{
Ext.getCmp("app_idCAPSIndicator").setText("");
}
}
if (e.getKey() == 13)
{
Ext.Msg.alert("Enter pressed");
}
}
}
},{
xtype: 'label',fieldLabel: '',labelWidth: 90,labelAlign: 'left',labelSeperator: '',id: 'app_idCAPSIndicator'
}
最佳答案
添加enableKeyEvents:true,如果为true,则为HTML输入字段启用键事件的代理
{
xtype:'textfield',enableKeyEvents: true,
原文地址:https://www.jb51.cc/js/531137.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。