html tutorial - onshow Attribute in HTML - html5 - html code - html form
Learn html - html tutorial - Onshow attribute in html - html examples - html programs
- The onshow attribute trigger an event when a <menu> element is displayed as a context menu.
Syntax for onshow attribute in HTML:
Differences between HTML 4.01 and HTML5 for onshow attribute:
HTML 4.01
- The <menu> tag was deprecated in HTML4.
HTML 5
- HTML5 redefined the <menu> tag.
Applies To:
Element | Attribute |
---|---|
<menu> | onshow |
Attribute Values:
Value | Description |
---|---|
script | The script can run on onshow |
Sample Coding for onshow Attribute in HTML:
Code Explanation for onshow Attribute in HTML:
- Using contextmenu attribute we can create a context menu for the element.
- <menu> tag is used to define the list of the commands for menu list.
- type=” context” attribute used to specify the context menu.
- onshow attribute calls the JavaScript function onShow() when user try to display the context menu.
- The JavaScript Function onShow() shows the alert dialogue box with the message "The context menu is about to be displayed".
Output for onshow Attribute in HTML:
- The output has been displayed.
- Right click the box, the alert box has been.
- After clicking the OK button in the alert box, the contextmenu has been displayed.
Browser Support for onshow Attribute in HTML:
No | No | 8.0 | No | No |