HTML DOM accessKey 屬性
定義和用法
accessKey 屬性可設(shè)置或返回訪(fǎng)問(wèn)文本域的快捷鍵。
注釋?zhuān)?/span>請(qǐng)使用 Alt + accessKey 為擁有指定快捷鍵的元素賦予焦點(diǎn)。
語(yǔ)法
textObject.accessKey=accessKey
實(shí)例
下面的例子設(shè)置了文本域的快捷鍵:
<html>
<head>
<script type="text/javascript">
function setAccessKeys()
{
document.getElementById('fname').accessKey="n"
document.getElementById('pwd').accessKey="p"
}
</script>
</head>
<body onload="setAccessKeys()">
<form>
Name: <input id="fname" type="text" />
<br />
Password: <input id="pwd" type="password" />
</form>
</body>
</html>