HTML DOM accessKey Property
Complete Text Object Reference
Definition and Usage
The accessKey property sets or returns the keyboard key to access a text
field.
Note: Use Alt + accessKey to give focus to the
elements with a specified access key.
Syntax
textObject.accessKey=accessKey
|
Example
The following example sets access keys to text fields.
<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>
|
Try-It-Yourself Demos
Add
accessKeys to text fields
Add
accessKeys to several form fields
Complete Text Object Reference
|