HTML contextmenu attribute
Examples
Provisions <div> element context menu. When the user right element will display a context menu:
<div contextmenu="mymenu">
<menu type="context" id="mymenu">
<menuitem label="Refresh"></menuitem>
<menuitem label="Twitter"></menuitem>
</menu>
</div>
<menu type="context" id="mymenu">
<menuitem label="Refresh"></menuitem>
<menuitem label="Twitter"></menuitem>
</menu>
</div>
try it"
Browser Support
At present, only Firefox browsers support contextmenu attribute.
Definition and Usage
contextmenu attribute specifies the context menu elements. When the user right element will display the context menu. / P>
Contextmenu attribute value is the id need to open the <menu> element.
Differences between HTML 4.01 and HTML5
contextmenu attribute is new in HTML5 attributes.
grammar
<elementcontextmenu="menu_id">
Property Value
值 | 描述 |
---|---|
menu_id | 要打开的 <menu> 元素的 id。 |
HTML Global Attributes