我怎样才能停下来keypress
keydown 处理程序中的事件?
即使从 keydown 中也无法停止按键......它们都是非常独立的事件。您可以做的是在读取字符后取消按键/按键。这是我只允许在文本框中输入字母和数字的方法(jQuery)
urlBox.keypress(function(e){
if(e.which == 13 || e.which == 8 || e.which == 0) return true;
if(48 <= e.which && e.which <= 57) return true;
if(65 <= e.which && e.which <= 90) return true;
if(97 <= e.which && e.which <= 122) return true;
return false;
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)