Last Updated on April 26, 2023 by Roshan Parihar
HTML menu tag is used to specify a list of commands in HTML.
The type attribute specifies the type of menu to display.
Syntax
1 |
<menu type="specify type here" >put menuitems here...</menu> |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<img src="../images/nature.jpg" id="myPic" width="250" alt="What is HTML menu tag?" height="250" contextmenu="mymenuimg"/> <menu type="context" label="mycommands" id="mymenuimg"> <menuitem label="red" onclick="changeColor('red');"></menuitem> <menuitem label="green" onclick="changeColor('green');"></menuitem> <menuitem label="violet" onclick="changeColor('violet');"></menuitem> <menuitem label="pink" onclick="changeColor('pink');"></menuitem> </menu> <script type="text/javascript"> function changeColor (thisColor) { document.getElementById('myPic').style.borderColor = thisColor; } </script> The script only works in Firefox. |
Output
The script only works in Firefox.
List of HTML menu tag attributes
Sr. No. | Atribute options | Description |
---|---|---|
1 | type | Specify the type of menu to display. The values for this attribute are context,toolbarpopup and list |
2 | label | This specified the label of menu. |