Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy oncontextmenu attribute</title> </head> <body> <div style="background:cyan; padding:20px;" oncontextmenu="onContextMenu()" contextmenu="wikiContext"> <p>Right click the box to View Wikitechy Context Menu </p> <menu type="context" id="wikiContext"> <menuitem label="Wikitechy" onclick="window.open('http://www.wikitechy.com');" icon="icon.png"> </menuitem> <menu label="Online"> <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 onContextMenu() { alert("You right-clicked inside the div!"); } </script> </body> </html>
Result