Set the access key of a link:
document.getElementById("myAnchor").accessKey = "w";
Try it Yourself »
Return the accesskey of a link:
document.getElementById("myAnchor").accessKey;
Try it Yourself »
The accessKey
property sets or returns the accesskey attribute of an element.
The accessKey
property specifies a shortcut key to activate or focus an element.
Using accesskeys is difficult because they may conflict with other key standards in the browser.
To avoid this problem, most browsers will use accesskeys only if pressed together with the Alt key.
Adapting accesskeys to all international languages is difficult.
The accesskey value may not be present on all keyboards.
Because of these concerns, it is advised not to use accesskeys.
Return the accessKey property:
element.accessKey
Set the accessKey property:
element.accessKey =
character
Value | Description |
character | Specifies the shortcut key to activate/focus the element. |
Type | Description |
String | A keyboard key. |
element.accessKey
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!