开发者

keyPressListener in document

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜