THE WORLD'S LARGEST WEB DEVELOPER SITE

onshow Event

❮ Event Object

Example

Execute a JavaScript when a <menu> element is shown as a context menu:

<div contextmenu="mymenu">
  <p>Right-click inside this box to see the context menu!
  <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 event occurs when a <menu> element is shown as a context menu.


Browser Support

The numbers in the table specify the first browser version that fully supports the event.

Event
onshow Not supported Not supported 8.0 Not supported Not supported


Syntax

In HTML:

<element onshow="myScript">
Try it Yourself »

In JavaScript:

object.onshow = function(){myScript};
Try it Yourself »

In JavaScript, using the addEventListener() method:

object.addEventListener("show", myScript);
Try it Yourself »

Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.


Technical Details

Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <menu>
DOM Version: Level 3 Events

Related Pages

HTML reference: HTML contextmenu attribute

HTML reference: HTML <menu> tag


❮ Event Object