开发者

keyPressListener in document

开发者 https://www.devze.com 2023-03-17 05:42 出处:网络
There exist any method like document.addKeyPressListe开发者_开发知识库ner, DOM.addKeyPressKistener or anything else?yes, there is document.onKeyDown

There exist any method like document.addKeyPressListe开发者_开发知识库ner, DOM.addKeyPressKistener or anything else?


yes, there is document.onKeyDown

you use that with a callback function that fires after the key is pressed. Also, you can get what key was pressed as an integer pertaining to the key.

http://www.java2s.com/Tutorial/JavaScript/0280__Document/documentonkeydown.htm


You can either use addDomHandler on the RootPanel.get() (which wraps the document's <body>) or RootLayoutPanel.get(), or use Event.addNativePreviewHandler.

0

精彩评论

暂无评论...
验证码 换一张
取 消