English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML onshow event attribute

The show event is triggered when the contextmenu event of an element with the contextmenu attribute is triggered or bubbled to the element.

HTML Event Attributes

Online Example

When the JavaScript is executed when the <menu> element is displayed in the context menu:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
</head>
<body>
<div contextmenu="test"></div>
<menu type="context" id="test">
    <menuitem label="alert" onclick="alert('the alert label has been clicked')" />
</menu>
<script>
  document.getElementById("test").addEventListener("show", function(e){
    alert("the context menu will be displayed");
  }, false);
</script>
</body>
</html>
Test to see ‹/›

Definition and Usage

The onshow attribute is activated when the <menu> element is displayed as a context menu.

Browser Compatibility

IEFirefoxOperaChromeSafari

Currently, only the onshow event attribute is supported by the browser firefox.

HTML 4.01 with HTML5 differences

onshow event attribute is a feature of HTML5new features added in.

Syntax

<element onshow="script">

Attribute Value

ValueDescription
scriptScript Execution in onshow

Technical Details

Supported HTML Tags:<menu>

Related Pages

HTML DOM Reference Manual: onshow Event


HTML Event Attributes