accelerator style property
Specifies or returns whether the object contains an accelerator key.
The underlined accelerator keys are only visible when the ALT key is pressed.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: accelerator |
Possible values:
The type of this property is string.
One of the following values:
The object does not contain an accelerator key. | |||||||
The object contains an accelerator key. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the accelerator property:
|
||||
<head> <style> .example { accelerator: true; } </style> </head> <body> <label for="user"><u class="example">U</u>ser Name: </label> <input type="text" id="user" accesskey="U" value="User name here" /> <br /><br />Press the ALT + U to use the accelerator! </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the accelerator property in JavaScript:
|
||||
<head> <script type="text/javascript"> function ChangeAcceleratorState (button) { var uObj = document.getElementById ("myU"); if ('accelerator' in uObj.style) { var accState = uObj.style.accelerator; uObj.style.accelerator = (accState == "true")? "false" : "true"; button.innerHTML = "Change accelerator to " + ((accState == "true")? "true" : "false"); } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <label for="name"><u id="myU" style="accelerator:true;">N</u>ame: </label> <input id="name" type="text" accesskey="N" value="Enter your name!" /> <br /><br /> Press the ALT key and view the (N) at the beginning of the "Name" label!<br /> If you press ALT + N, the cursor will jump into the labels input field. <button onclick="ChangeAcceleratorState (this);">Change the accelerator state!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CSSStyleDeclaration, htmlElement.currentStyle, htmlElement.runtimeStyle, htmlElement.style
HTML elements:
a, abbr, acronym, address, b, bdo, big, blockquote, body, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, ins, isindex, kbd, label, legend, li, listing, menu, ol, p, pre, q, rt, ruby, s, samp, small, span, strike, strong, sub, sup, textarea, tt, u, ul, var, xmp
External links:
User Contributed Comments