accessKeyLabel - Web APIs 编辑
The HTMLElement.accessKeyLabel
read-only property returns a String
containing the element's browser-assigned access key (if any); otherwise it returns an empty string.
Syntax
label = element.accessKeyLabel
Example
JavaScript
var btn = document.getElementById('btn1');
var shortcutLabel = btn.accessKeyLabel || btn.accessKey;
btn.title += ' [' + shortcutLabel.toUpperCase() + ']';
btn.onclick = function () {
var feedback = document.createElement('output');
feedback.textContent = 'Pressed!';
btn.insertAdjacentElement('afterend', feedback);
};
HTML
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
Result
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLElement.accessKeyLabel' in that specification. | Living Standard | No change from initial definition. |
HTML 5.1 | Recommendation | Removed. pull w3c/html#144, issue w3c/html#99, WICG discussion. |
HTML5 The definition of 'HTMLElement.accessKeyLabel' in that specification. | Recommendation | Snapshot of HTML Living Standard, initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
element.accessKey
- The accesskey global attribute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论