他の "Try it Yourself" の例が下にあります。
onkeydown 属性は、ユーザが(キーボードの)キーを押しているときに発火します。
チップ: onkeydown イベントに関連するイベントの順序:
イベント属性 | |||||
---|---|---|---|---|---|
onkeydown | Yes | Yes | Yes | Yes | Yes |
なし。
<element onkeydown="script">
値 | 説明 |
---|---|
script | script は onkeydown で実行される |
サポートする HTML タグ: | 次の要素を除くすべての HTML 要素: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
---|
"onkeyup" 属性と一緒に "onkeydown" を使用します:
<input type="text" onkeydown="keydownFunction()" onkeyup="keyupFunction()">
Try it Yourself ❯
HTML DOM リファレンス:onkeydown イベント