html <command> 标签可以定义用户可能调用的命令,比如单选按钮、复选框或按钮
当使用 <menu> 元素时,command 元素将作为菜单或者工具栏的一部分显示出来
但是,用 command 设置键盘快捷键时,command 元素能被放置在页面的任何位置,但元素不可见
浏览器支持
目前,主流浏览器都不支持 <command> 标签
只有 IE 9 支持 <command> 标签,其它之前版本或者之后版本的 IE 浏览器不支持 <command> 标签
html 4.01 与 HTML5之间的差异
<command> 标签是 HTML 5 中的新标签
属性
属性 | 值 | 描述 |
---|---|---|
checked |
checked | 设置当页面加载时,command 是否被选中 仅用于 radio 或 checkbox 类型 |
disabled |
disabled | 设置 command 是否可用 |
icon |
URL | 设置作为 command 来显示的图像的 URL |
label |
text | 必需,设置 command 的名字,对用户可见 |
radiogroup |
groupname | 设置可进行切换且将被切换的 command 所属的组名 仅在类型为 radio 时使用 |
type |
checkbox command radio |
定义 command 的类型。默认是 "command" |
范例
<command> 可以进行如下标记
<menu> <command type="command" label="Save" onclick="save()">Save</command> </menu>