Mozilla XUL Element and Script Reference

Contents  Quick Reference

Key

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

Attributes:

Attributes inherited from XUL Element


alt

If true, the Alt key must be pressed for the key to match. If false, the Alt key must not be pressed for the key to match. If unspecified, it doesn't matter whether the key is pressed or not. This will map to another key on platforms that do not have an Alt key. For example, on the Macintosh, this refers to the Option key.

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.

control

If true, the Control key must be pressed for the key to match. If false, the Alt key must not be pressed for the key to match. If unspecified, it doesn't matter whether the key is pressed or not. This will map to another key on platforms that do not have an Control key.

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.

meta

If true, the Meta key must be pressed for the key to match. If false, the Meta key must not be pressed for the key to match. If unspecified, it doesn't matter whether the key is pressed or not. This will map to another key on platforms that do not have an Meta key. For example, on the Macintosh, this refers to the Command key.

shift

If true, the Shift key must be pressed for the key to match. If false, the Shift key must not be pressed for the key to match. If unspecified, it doesn't matter whether the key is pressed or not.

xulkey

The xulkey refers to the platform-specific key that is normally used to invoke keyboard shortcuts. For example, on Windows this is Control. On the Macintosh, the is this Command key. If this attribute is set to true, this key must be pressed for the key to match. If false, this key must not be pressed for the key to match. If unspecified, it doesn't matter whether this key is pressed or not.