ACCESSKEY Attribute | accessKey Property
Sets or retrieves the accelerator key for the object.
Syntax
HTML <ELEMENT ACCESSKEY = sAccessKey ... > Scripting object.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">
Applies To
[ Object Name ] Platform Version Win16: Win32: Mac: Unix: WinCE: Version data is listed when the mouse hovers over a link, or the link has focus. 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
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.