ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# HTML &lt;command&gt; 标签 ## 实例 标记一个按钮: ``` <menu> <command onclick="alert('Hello World')"> Click Me!</command> </menu> ``` ## 浏览器支持 | IE | Firefox | Chrome | Safari | Opera | | --- | --- | --- | --- | --- | 没有浏览器支持 &lt;command&gt; 标签。 只有 Internet Explorer 9 (更早或更晚的版本都不支持)支持 &lt;command&gt; 标签。 ## 定义和用法 command 元素表示用户能够调用的命令。 &lt;command&gt; 标签可以定义命令按钮,比如单选按钮、复选框或按钮。 只有当 command 元素位于 menu 元素内时,该元素才是可见的。否则不会显示这个元素,但是可以用它规定键盘快捷键。 ## 浏览器支持 目前只有 Internet Explorer 支持 &lt;command&gt; 标签。 ## HTML 4.01 与 HTML 5 之间的差异 &lt;command&gt; 标签是 HTML 5 中的新标签。 ## 属性 new : HTML5 中的新属性。 | 属性 | 值 | 描述 | | --- | --- | --- | | [checked](/tags/att_command_checked.asp "HTML5 &lt;command&gt; checked 属性") | checked | 定义是否被选中。仅用于 radio 或 checkbox 类型。 | | [disabled](/tags/att_command_disabled.asp "HTML5 &lt;command&gt; disabled 属性") | disabled | 定义 command 是否可用。 | | [icon](/tags/att_command_icon.asp "HTML5 &lt;command&gt; icon 属性") | _url_ | 定义作为 command 来显示的图像的 url。 | | [label](/tags/att_command_label.asp "HTML5 &lt;command&gt; label 属性") | _text_ | 为 command 定义可见的 label。 | | [radiogroup](/tags/att_command_radiogroup.asp "HTML5 &lt;command&gt; radiogroup 属性") | _groupname_ | 定义 command 所属的组名。仅在类型为 radio 时使用。 | | [type](/tags/att_command_type.asp "HTML5 &lt;command&gt; type 属性") | `checkbox` `command` `radio` | 定义该 command 的类型。默认是 "command"。 | ## 全局属性 &lt;command&gt; 标签支持 [HTML 中的全局属性](/tags/html_ref_standardattributes.asp)。 ## 事件属性 &lt;command&gt; 标签支持 [HTML 中的事件属性](/tags/html_ref_eventattributes.asp)。