HTML onkeydown event properties
Examples
Run the script when you press the button:
<input type="text" onkeydown="displayResult()">
try it"
Browser Support
All major browsers support onkeydown event attributes
Definition and Usage
onkeydown properties when the user presses the trigger button (on the keyboard).
Tip: onkeydown events related to the event firing order:
- onkeydown
- onkeypress
- onkeyup
Note: onkeydown property is not available for the following elements: <base>, <bdo> , <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.
Differences between HTML 4.01 and HTML5
no.
grammar
<elementonkeydown=" script ">
Property Value
值 | 描述 |
---|---|
script | 规定该onkeydown事件触发时执行的脚本。 |
HTML Event Attributes