English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
accessKeyAttribute sets or returnsaccessKeyElement properties.
accessKeyAttribute sets the key pressed to jump to this element's keystroke
Note:The way to access shortcuts varies in different browsers:
Chrome, Safari, Opera 15 +, IE:[ALT] + Shortcut Key
Previous versions of Opera15:[SHIFT] [ESC] + Shortcut Key
Firefox:[ALT] [SHIFT] + Shortcut Key
Return accessKey attribute:
element.accessKey
Set accessKey attribute:
element.accessKey = character
document.getElementById("demo").accessKey = "p";Test See‹/›
All browsers fully support the accessKey attribute:
Attribute | |||||
accessKey | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
character | Specify a shortcut key, and users can jump to the element using this shortcut key |
Return Value: | Characters on the keyboard |
---|---|
DOM Version: | DOM Level1 |
Get the access key of the link:
var x = document.getElementById("demo").accessKey;Test See‹/›
HTML Reference:HTML accessKey attribute