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
.
精彩评论