HTML attr accesskey

From Htmlpedia
Jump to: navigation, search

HTML Attribute accesskey

Definition and Usage

accesskey = Character
The accesskey attribute is used to assign a shortcut key to an HTML element of the following types A, AREA, BUTTON, INPUT, LABEL, LEGEND, and TEXTAREA 1.
When the user performs the appropriate keystroke focus is moved to the element.

  • If the element is a link the link is followed to the referenced document.
  • If the element is an input or label the cursor is moved to that element.

Depending on the browser, the keystroke to use the accesskey will differ (CHARACTER is any character in the containing documents charset).

  • Internet Explorer use: ALT-CHARACTER
  • Mozilla Firefox use: ALT-SHIFT-CHARACTER
  • Opera use: SHIFT-ESC then CHARACTER
  • Other browsers may use other shortcuts.


Example

<a href="http://www.htmlpedia.org" accesskey='z'>test</a>
Goodaccesskey z to activate this link


Problem:

Be careful that you do not use a shortcut keystroke that is used by one of the more common toolbars (google toolbar uses g) as the toolbar shortcut key will most likely supersede your accesskey.


References

  1. HTML 4.01 Specification, 17.11.2 Access keys

Back to HTML Elements


last edit by --Jim 17:58, 2 April 2007 (CEST)