HTML | DOM Menu Object Last Updated : 09 Feb, 2022 Comments Improve Suggest changes Like Article Like Report The DOM Menu Object is used to represent an HTML <menu> element. This tag defines a list of commands. It is used for context menus, toolbars and for listing form controls and commands. Syntax: Accessing Menu Object var y = document.getElementById("myMenu"); Creating Menu Object var y = document.createElement("MENU"); Properties: label: It sets or returns the value of label attribute of the menu. type: It sets or returns the value of type attribute of the menu. Examples-1: Accessing Menu Object. html <!DOCTYPE html> <html> <body> <div style="background:green; padding: 10px;" contextmenu="MENU"> <p>Right-click inside the box to see the context menu!!!</p> <menu type="context" id="MENU"> <menuitem label="Refresh" onclick="window.location.reload();" icon="ico_reload.png"> </menuitem> <menuitem label="Email This Page" onclick="window.location= 'mailto:?body=' +window.location.href;"> </menuitem> </menu> </div> <script> function Geeks() { var y = document.getElementById("MENU"); } </script> <p>This example can work only on Firefox!</p> </body> </html> Output: Example-2: Creating Menu Object. html <!DOCTYPE html> <html> <body> <div style="background:pink; padding: 10px;" contextmenu="MENU"> <p>Right-click inside the box to see the context menu!!!</p> <menu type="context" id="MENU"> <menuitem label="Refresh" onclick="window.location.reload();" icon="ico_reload.png"> </menuitem> <menuitem label="Email This Page" onclick="window.location= 'mailto:?body=' +window.location.href;"> </menuitem> </menu> </div> <script> function Geeks() { //creating menu var y = document.createElement("MENU"); document.getElementById("MENU"); } </script> <p>This example can work only on Firefox!</p> </body> </html> Output: Note: The element is currently NOT supported in any of the major browsers. Browsers Supported: Mozilla Firefox-8.0 Comment More infoAdvertise with us Next Article HTML | DOM Menu Object K kartikgoel1999 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM MenuItem Object The DOM MenuItem Object is used to represent an HTML <menuitem> element. This tag defines the content and action for each menu item in the context menu. This can also be configured for certain types of input like checkboxes and radio buttons. Syntax: Accessing MenuItem ObjectCreating MenuItem 3 min read HTML DOM Nav Object The DOM nav object is used to represent the HTML <nav> element. The<nav> element is accessed by getElementById(). Syntax: document.getElementById("id") Where id is assigned to the <nav> tag. Note: The Nav Object is not supported by Internet Explorer 8 and earlier versions. Example 1 min read HTML DOM Mark Object The Mark Object in HTML DOM is used to represent the HTML <mark> element. The Mark Object is new in HTML 5. The <mark> element can be accessed by using the getElementById() method. Syntax: document.getElementById("id") Where id is assigned to the <mark> tag. Note: This tag is not s 1 min read HTML DOM li Object The DOM Li Object is used to represent the HTML <li> element. The li element is accessed by getElementById(). Properties: value: It has an attribute named value which is used to return the value of the value attribute of the <li> tag. Syntax: document.getElementById("ID"); Where âidâ is 1 min read HTML | DOM Ul Object The DOM Ul Object is used to represent the HTML <ul> element .the ul element is accessed by getElementById().Properties: compact: It is used to set or return whether the height of the unordered list would be render smaller than normal, or not. type: It is used to set or return the value of the 2 min read Like