English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML reference manual

HTML tag大全

HTML: <command> Tag

The command element is used to represent a command that a user can call.

Online example

The <command> tag can be marked as follows:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
<script>
function save()
{
    alert("Some JavaScript....");
}
</script>
</head>
<body>
<menu>
<command type="command" label="Save" onclick="save()">Save</command>
</menu>
<p><b>Attention:</b>Only IE 9 Supports the command tag.</p>
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

Currently, mainstream browsers do not support the <command> tag.

Note:Only IE 9 Supports the <command> tag, other IE browsers of previous or later versions do not support the <command> tag.

Definition and usage instructions of the tag

The <command> tag can define commands that users may call (such as radio buttons, checkboxes, or buttons).

When using the <menu> element, the command element is displayed as part of the menu or toolbar. However, when defining keyboard shortcuts with command, the command element can be placed at any position on the page, but the element is not visible.

HTML 4.01 and HTML5differences between

<command> tag is a part of HTML 5 new tag in

Attribute

New : HTML5 new attribute in

AttributeValueDescription
checkedHTML5checkedSpecify whether the command is selected when the page is loaded. Used only for radio or checkbox types.
disabledHTML5disabledSpecify whether the command is available.
iconHTML5URLSpecify the URL of the image to be displayed as the command.
labelHTML5textRequired. Specify the name of the command, visible to the user.
radiogroupHTML5groupnameSpecify the group name of the command that can be toggled and will be toggled. Used only when the type is radio.
typeHTML5checkbox
command
radio
Define the type of command. The default is "command".

Global Attributes

Support for <command> tag Global Attributes of HTML.

Event Attributes

Support for <command> tag HTML Event Attributes.