You are here: Reference > JavaScript > client-side > style handling > properties > accelerator

accelerator style property

Browser support:
Specifies or returns whether the object contains an accelerator key.
The underlined accelerator keys are only visible when the ALT key is pressed.


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:
        .example {
            accelerator: true;
    <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!
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the accelerator property in JavaScript:
    <script type="text/javascript">
        function ChangeAcceleratorState (button) {
            var uObj = document.getElementById ("myU");

            if ('accelerator' in {
                var accState =;
       = (accState == "true")? "false" : "true";
                button.innerHTML = "Change accelerator to " + ((accState == "true")? "true" : "false");
            } else {
                alert ("Your browser doesn't support this example!");
    <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>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content