过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
HTML Command element
(
<command>
) represents a command which the user can invoke. Commands are often used as part of a context menu or toolbar.
However, they can be used anywhere on the page.
<command>
element is included in the W3C specification, but not in the WHATWG specification, and browser support is nonexistent. You should use the
<menuitem>
element instead, although that element is non-standard and only supported in Edge and Firefox.
| 内容类别 | 流内容 , 措词内容 , metadata content. |
|---|---|
| 准许内容 | None, it is an empty element . |
| Tag omission | start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. |
| Permitted parent elements |
<colgroup>
only, though it can be implicitly defined as its start tag is not mandatory. The
<colgroup>
must not have a
<span>
as child.
|
| DOM 接口 |
HTMLCommandElement
|
此元素包括 全局属性 .
checked
type
属性为
checkbox
or
radio
.
被禁用
Indicates that the command is not available.
icon
Gives a picture which represents the command.
label
The name of the command as shown to the user.
radiogroup
type
of
radio
, that will be toggled when the command itself is toggled. This attribute must be omitted unless the
type
属性为
radio
.
type
命令
or empty which is the default state and indicates that this is a normal command.
checkbox
indicates that the command can be toggled using a checkbox.
radio
indicates that the command can be toggled using a radio button.
<command type="command" label="Save"
icon="icons/save.png" onclick="save()">
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML5
The definition of '<command>' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
命令
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
不支持
No
注意事项
|
IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
不支持
No
注意事项
|
Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
checked
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
被禁用
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
icon
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
label
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
radiogroup
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
type
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
<command>