command element

The command element specifies the command that will instantiate the add-in.

It is required only for commands. Do not include the command element for panels.

Elements

The command element can contain the following elements:

The menuitem element specifies the menu item created to execute the add-in, or to make the panel visible if it is a panel add-in.

For details about the menuitem element and its attributes, see menuitem element.

toolbaritem

The toolbaritem element specifies the toolbar item created to execute the add-in, or to make the panel visible if it is a panel add-in.

For details about the toolbaritem element and its attributes, see toolbaritem element.

Attributes

The command element has the following attributes:

id

id="unique ID" [required]

The id attribute is a unique string used to identify this command tag. It is used internally by Expression Web.

onclick

onclick="expression" [default]

The onclick attribute specifies the JavaScript expression that will be executed when the add-in is invoked. The onclick expression is typically used for command add-ins that execute without a user interface when a menu command is selected. To call a JavaScript function, use the function name with the parentheses.

filetype

filetype="list of comma-separated file types" [optional]

The filetype attribute is used to specify what kinds of files the command can work with. If the active document is associated with the filetype list, the menu item, the toolbar button, or both will be enabled. Otherwise, they will be disabled. The following is a list of valid file types:

  • HTML   An HTML file with the file name extension .htm or .html.

  • PHP   A PHP file with the file name extension .php, .php3, or .php4.

  • ASP   An ASP or ASPX file with the file name extension. asp, .aspx, .ascx, or .asmx.

  • CSS   A cascading styles sheet (CSS) file with the file name extension .css.

  • JS    A JavaScript file with the file name extension .js.

  • HTML-DOM   An HTML, PHP, ASP, or ASPX file that contains an HTML DOM.

  • TXT   A plain text file with the file name extension .txt.

  • XML   An XML file with the file name extension .xml.

  Copyright © 2011 by Microsoft Corporation. All rights reserved.