« XUL Reference home
oncommand
Type: script code
This event handler is called when the command is activated. This occurs when a user selects a menu item or presses a keyboard shortcut attached to the command.

Example 1: in-line code

<button label="Click me" oncommand="alert('Hi')"/>

Example 2: function with source argument

<button label="Click me" oncommand="doSomeProcessing(event.target)"/>
And here is the definition of the function:
function doSomeProcessing(source) {
  alert("source: " + source);
  return true;
}

See also

command element