我使用了命令标记,但输出不正确 这是代码:
<html>
<body>
<menu>
<command onclick="alert('Hello World')">Click here</command>
</menu>
</body>
</html>
我在firefox和Internet Explorer中查看输出。
答案 0 :(得分:0)
除Internet Explorer 9之外的任何浏览器都不支持命令标记 http://www.w3schools.com/tags/tag_command.asp
答案 1 :(得分:0)
目前仅在IE 9中支持<command>
标记,而不是早期版本或更高版本,或任何其他浏览器。
http://www.w3schools.com/tags/tag_command.asp
答案 2 :(得分:0)
command
元素已在各种草案中提出,包括2012年的first HTML5 CR(由于缺乏实施而被标记为“有风险”),但它已被删除更新的草稿。因此,它的任何实现以及相关的Command API都应被视为实验性的。
目前的草案有menuitem
element用于类似目的。但请注意,它只是一个提议的元素,它不存在于currentl HTML5 CR中,它可能仅限于Firefox中的实验性实现。
结论取决于你想要达到的目标。 command
的想法是与menu
元素, a way of setting up a dropdown menu of scripted operations. In the simplest case, you can do such things with the normal
选择element with an
onchange`属性一起提供执行不同操作的值,具体取决于所选的索引选项。