Home > Element Reference : Key

Contents

### Key

The key element defines a keyboard shortcut. Event handlers can be used to respond when the appropriate keys are pressed.

More information about Key

#### Attributes:

Attributes inherited from XUL Element

cancel

Set to true if the key, if fired should cancel the event chain.

charcode

The character that is must be pressed. This should be set to a displayable character.

disabled

Set to true to disable the key. This is often used with a broadcaster to disable a menu command and key at the same time.

keycode

For keys that do not have displayable characters, such as the enter key or function keys, use this attribute, instead of charcode. Valid keys are listed here.

modifiers

A list of modifier keys that should be pressed to invoke the keyboard shortcut. Multiple keys may be separated by spaces or commas. Keys will map to other keys on platforms that do not have them.

- shift: The Shift key.
- alt: The Alt key. On the Macintosh, this is the Option key.
- meta: The Meta key. On the Macintosh, this is the Command key.
- control: The Control key.
- accel: The key used for keyboard shortcuts on the user's platform. Usually, this would be the value you would use.

#### Properties and Methods:

Properties and Methods inherited from XUL Element

Copyright (C) 1999 - 2002 XULPlanet.com