Javascript Reference
Categories: Obj_Button

javascript Obj_Button accessKey

@July 7, 2008, 4:22 a.m.
accessKey Firefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM 1  

 

Read/Write  

This is single character key that either gives focus to an Obj_Button element (in some browsers) or activates a form control or link action. The browser and operating system determine if the user must press a modifier key (e.g., Ctrl, Alt, or Command) with the access key to activate the link. In Windows versions of IE 5 and later and Netscape 6, the Alt key is required and the key is not case-sensitive. For Macintosh versions of IE 5 and later and Netscape 6, the Ctrl modifier key is required to effect the action.

 

Although listed here as a widely shared property, that isn't strictly the case across all implementations. Netscape 6 (per the W3C DOM) recognizes this property only for the following elements: a, area, button, input, label, legend, and textarea. To this list, IE 4 adds applet, body, div, embed, isindex, marquee, object, select, span, table, and td (but removes label and legend). IE 5 adds every other renderable element, but with a caution. Except for input and other form-related elements, you must also assign a tabindex attribute or tabIndex property value to the IE 5 and later element (even if it's simply a value of zero for all) to let the accelerator key combination bring focus to the element. As of Version 7, Netscape does not alter UI behavior if a script changes the property's value.

 
Example
 
document.links[3].accessKey = "n";
 
Value

Single alphanumeric (and punctuation) keyboard character.

 
Default

Empty string.


Powered by Linode.