accessKeyLabel - Web API 接口参考 编辑
HTMLElement.accessKeyLabel
只读属性返回一个 String
表示这个元素分配的访问密钥(如果有的话); 否则返回一个空字符串.
语法
label = element.accessKeyLabel
示例
JavaScript
var node = document.getElementById('btn1');
if (node.accessKeyLabel) {
node.title += ' [' + node.accessKeyLabel + ']';
} else {
node.title += ' [' + node.accessKey + ']';
}
node.onclick = function () {
var p = document.createElement('p');
p.textContent = 'Clicked!';
node.parentNode.appendChild(p);
};
HTML
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
Result
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard HTMLElement.accessKeyLabel | Living Standard | No change from initial definition. |
HTML 5.1 | Recommendation | Removed. pull w3c/html#144, issue w3c/html#99, WICG discussion. |
HTML5 HTMLElement.accessKeyLabel | Recommendation | Snapshot of HTML Living Standard, initial definition. |
浏览器兼容
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.See also
element.accessKey
- The accesskey global attribute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论