简体   繁体   中英

Enter key hit event is not getting captured in Firefox

When I ran my app(GWT java) using chrome browser the following code works well

if (event.getUnicodeCharCode() == 13) 

But the same app ran through Firefox browser doesn't give desirable result.

I want to capture the enter event from all browser and do the same processing code.

Firefox不会触发Enter键的keypress事件,你必须使用keydownkeyup (但是然后处理键代码,而不是字符代码;幸运的是,它们与Enter键和LF字符相同)。

而不是char代码查看键代码,与物理键关联的代码:

if (event.getKeyCode() == KeyCodes.KEY_ENTER)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM