HTML DOM MenuItem Obheto

MenuItem object

The MenuItem object represents the HTML <menuitem> element.

Note:Only Firefox supports the <menuitem> element.

Access MenuItem object

You can access the <menuitem> element using getElementById():

var x = document.getElementById("myMenuItem");

Create MenuItem object

You can create a <menuitem> element using the document.createElement() method:

var x = document.createElement("MENUITEM");

MenuItem object properties

属性 Description
checked Set or return whether the menu item is selected.
command Set or return the command attribute value of the menu item.
default Set or return whether the menu item is the default command.
disabled Set or return whether the menu item is disabled.
icon 设置或返回表示菜单项的图像。
label 设置或返回菜单项的 label 属性值。
radiogroup 设置或返回菜单项的 radiogroup 属性值。
type 设置或返回菜单项的 type 属性值。

标准属性和事件

MenuItem 对象支持标准属性事件

相关页面

HTML 参考手册:HTML <menuitem> 标签