Home > Element Reference : Command

Contents

### Command

A command element can be used to invoke an operation that can come from multiple sources. For example, a clipboard paste operation can be invoked from the Edit menu, a context menu and by pressing a keyboard shortcut. You attach the code to the command using the oncommand attribute. It will be called no matter how it is invoked by the user. In addition, disabling the command will automatically disable the menu items and keyboard shortcuts.

#### Attributes:

Attributes inherited from XUL Element

disabled

If you set the disabled attribute to true, any menu items and keys attached to the command become disabled. If you set the attribute to false, or preferably, remove it, the menu items and keys become enabled.

label

The label inherited by the menu items and keys that are attached to the command.

oncommand

This event handler is called when the command is activated. This occurs when a use selects a menu item or presses a keyboard shortcut attached to the command.

#### Properties and Methods:

Properties and Methods inherited from XUL Element

Copyright (C) 1999 - 2002 XULPlanet.com