Properties


ACCESSKEY Attribute | accessKey Property

Sets or retrieves the access key for the object.

Syntax

HTML<ELEMENT ACCESSKEY = sAccessKey... >
Scripting[ sAccessKey = ] object.accessKey

Possible Values

sAccessKeyString that specifies or receives a key on an alphanumeric keyboard.

The property is read/write. The property has no default value.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

By default, pressing an access key sets focus to an object. The object receives focus when the user simultaneously presses the ALT key and the access key assigned to an object. Some controls perform an action after receiving focus. For example, using accessKey on an input type=button causes the onclick event to fire. By comparison, applying the accessKey on a radio button causes the onclick event to fire and toggles the checked property, visibly selecting or deselecting the control.

As of Microsoft Internet Explorer 5, some scoped elements do not implicitly support the accessKey property. Instead, they support the property by setting the TABINDEX attribute to any valid negative or positive integer.

Note  For elements that are not tab stops by default, such as a SPAN, the tabIndex property must be set on the element for the accessKey property to function.

In Windows Internet Explorer 7 and greater, ALT+D selects text in the Address bar, making D unavailable as a keyboard shortcut on a Web page.

Example

This example uses the label object and the accessKey attribute to set focus on a text box. The label object makes it possible to underline the designated accessKey. You may also use the -ms-accelerator attribute to hide the underline until the ALT key is pressed.

<label for="fp1" accesskey="1">#<span style="text-decoration: underline;">1</span>: 
Press ALT+1 to set focus to textbox</label>
<input type="text" name="T1" value="text1" size="20" tabindex="1" id="fp1">
This feature requires Microsoft Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in HTML 4.0 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, hn, HR, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, Element Constructor

See Also

Tags :


Community Content

Mr. Raymond Kenneth Petry
Limitations - non contentEditable, for single id
Does not work for contentEditable.

FOR=id does not sequence on multiple occurrences of id.

Page view tracker