HTML DOM accessKeyProperty

元素对象参考手册Element Object


Definition and Usage

The accessKey property sets or returns the keyboard shortcut for accessing a radio button.

Note:Please useAlt + accessKeyGive focus to the element with the specified access key.

Syntax

HTMLElementObject.accessKey=accessKey


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the accessKey property.


Examples

Examples

The following example returns the keyboard shortcut for a radio button:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example (example.com)</title> <script> function accesskey(){   document.getElementById('example').accessKey="r"   document.getElementById('g').accessKey="g" } </script> </head> <body onload="accesskey()"> <a id="example" href="//www.example.com/">Example</a><br> <a id="g" href="//www.google.com/">Google</a> <p><b>Note:</b>Use Alt +<i> accesskey </i>to access the element with the specified access key.</p> </body> </html>

Try it Yourself »


元素对象参考手册Element Object

Other Extensions