onshow Event
Definition and Usage
An onshow event occurs when the <menu> element is displayed as a context menu.
Example
Execute JavaScript when the <menu> element is displayed as a context menu:
<div contextmenu="mymenu"> <p>Right-click inside this box to see the context menu!</p> <menu type="context" id="mymenu" onshow="myFunction()"> <menuitem label="Refresh" onclick="window.location.reload();"></menuitem> </menu> </div>
Syntax
In HTML:
<element onshow="myScript">
In JavaScript:
object.onshow = function(){myScript};
In JavaScript, use the addEventListener() method:
object.addEventListener("show", myScript);
Note:Internet Explorer 8 or earlier versions do not support addEventListener() Method.
Technical Details
Bubbling: | Not Supported |
---|---|
Cancelable: | Not Supported |
Event Type: | Event |
Supported HTML Tags: | <menu> |
DOM Version: | Level 3 Events |
Browser Support
The numbers in the table indicate the first browser version that fully supports this event.
Event | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
onshow | Not Supported | Not Supported | 8.0 | Not Supported | Not Supported |