Code
Execute
<!DOCTYPE html> <html> <head> <title>html tutorial - html5 - html code - html form - In 30Sec by Microsoft Award MVP - | wikitechy HTML onshow Attribute</title> </head> <body> <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="window.open('http://www.wikitechy.com');" icon="icon.png"> </menuitem> <menu type="context" id="wikiContext"> <menuitem label="Tutorials" icon="icon.png" onclick="window.open('http://www.wikitechy.com/online-tutorials');"> </menuitem> </menu> </menu> </menu> </div> <script> function onShow() { alert("The context menu is about to be displayed"); </script> </body> </html>
Result