Latest web development tutorials

HTML onkeydown event properties

HTML Event Attributes HTML Event Attributes

Examples

Run the script when you press the button:

<input type="text" onkeydown="displayResult()">

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:

  1. onkeydown
  2. onkeypress
  3. 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 HTML Event Attributes