HTML onshowEvent Attributes
Example
Execute JavaScript when the <menu> element is displayed in the context menu:
<div contextmenu="mymenu">
<p>Right-click the yellow box area to view the context menu!</p>
<menu type="context" id="mymenu" onshow="myFunction()">
<menuitem label="Refresh" onclick="window.location.reload();"></menuitem>
</menu>
</div>
<p>Right-click the yellow box area to view the context menu!</p>
<menu type="context" id="mymenu" onshow="myFunction()">
<menuitem label="Refresh" onclick="window.location.reload();"></menuitem>
</menu>
</div>
Try it Yourself »
Definition and Usage
The onshow attribute triggers when the <menu> element is displayed in the context menu.
Browser Support
The numbers in the table specify the first browser version that fully supports the event.
| Event Attributes | |||||
|---|---|---|---|---|---|
| onshow | Not supported | Not supported | 8.0 | Not supported | Not supported |
Differences Between HTML 4.01 and HTML5
The onshow attribute is new in HTML5.
Syntax
<element onshow="script">
Attribute Values
| Value | Description |
|---|---|
| script | Script to be executed when onshow occurs. |
Technical Details
| Supported HTML tags: | <menu> |
|---|
Related Pages
HTML DOM Reference:onshow Event
Other Extensions
HTML Event Attributes