html tutorial - onshow Attribute in HTML - html5 - html code - html form

Onshow attribute in html

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:

<menu onshow=”script”>

Differences between HTML 4.01 and HTML5 for onshow attribute:

HTML 4.01

  • The <menu> tag was deprecated in HTML4.


  • 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:

Tryit<!DOCTYPE html>
         <title>Wikitechy onshow attribute</title>
      <div style="background:cyan;padding:20px;" contextmenu="wikiContext">
      <p>Right click the box to View Wikitechy Context Menu</p>
      <menu type="context" id="wikiContext" onshow="onShow()">
      <menuitem label="Wikitechy" onclick="'');" icon="icon.png">
      <menu label="Online">
      <menu type="context" id="wikiContext">
      <menuitem label="Tutorials" icon="icon.png" onclick="'');">
      function onShow() 
        alert ("The context menu is about to be displayed");

Code Explanation for onshow Attribute in HTML:

onshow Attribute Code Explanation

  1. Using contextmenu attribute we can create a context menu for the element.
  2. <menu> tag is used to define the list of the commands for menu list.
  3. type=” context” attribute used to specify the context menu.
  4. onshow attribute calls the JavaScript function onShow() when user try to display the context menu.
  5. 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:

onshow Attribute Tag Output

  1. The output has been displayed.
onshow Attribute Tag Output

  1. Right click the box, the alert box has been.
onshow Attribute Tag Output

  1. 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

Related Searches to onshow Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.