---
title: GlobalEventHandlers.onkeydown
slug: Web/API/GlobalEventHandlers/onkeydown
translation_of: Web/API/GlobalEventHandlers/onkeydown
---
<div>{{ ApiRef("HTML DOM") }}</div>

<h3 id="概述">概述</h3>

<p><strong>onkeydown</strong>属性用来获取或设置当前元素的<code>keydown</code>事件的事件处理函数.</p>

<h3 id="语法">语法</h3>

<pre class="eval">element.onkeydown = <em>event handling code</em>
</pre>

<h3 id="备注">备注</h3>

<p>当用户按下键盘上的按键时会触发<code>keydown</code>事件.</p>

<h3 id="规范">规范</h3>

<p>不属于任何公开的规范.</p>

<p>{{ languages( { "fr": "fr/DOM/element.onkeydown", "pl": "pl/DOM/element.onkeydown", "en": "en/DOM/element.onkeydown" } ) }}</p>