Click to return to the DHTML, HTML     
@media Rule     ACTION Attribute | action...     DHTML Properties    
Web Workshop  |  DHTML, HTML & CSS

ACCESSKEY Attribute | accessKey Property


Sets or retrieves the accelerator key for the object.

Syntax

HTML<ELEMENT ACCESSKEY = sAccessKey ... >
Scriptingobject.accessKey [ = sAccessKey ]

Possible Values

sAccessKey String of characters that specify a key on an alphanumeric keyboard.

The property is read/write with no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.

Remarks

By default, the accessKey property sets focus to the object. The object receives focus when the user simultaneously presses the ALT key and the accelerator key assigned to an object. Some controls perform an action after receiving focus. For example, using accessKey on a 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 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.

Example

This example uses the LABEL object and the accessKey property to set focus on a text box. The rich text support in the LABEL object makes it possible to underline the designated accessKey.

Sample Code

<LABEL FOR="fp1" ACCESSKEY="1">#<U>1</U>: 
    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 Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
A, 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, 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


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.