语法
label = element.accessKeyLabel
示例
>JavaScript
js
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
html
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
结果
规范
| 规范 |
|---|
| HTML> # dom-accesskeylabel> |
浏览器兼容性
参见
element.accessKey- The accesskey global attribute.