- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Execute a script when a
When a <menu> element is shown as a context menu in HTML, the onshow event fires.
Example
You can try to run the following code to execute a script when a <menu> element is displayed as a context menu −
<!Doctype html> <html> <head> <title>HTML menu</title> </head> <body> <div style = "border:1px solid #000; padding:20px;" contextmenu = "clickmenu"> <p>Right click inside here....</p> <menu type = "context" id = "clickmenu" onshow="display()"> <menuitem label = "Tutorialspoint" onclick = ""></menuitem> <menuitem label = "Tutorials Library" onclick = ""></menuitem> <menuitem label = "Coding Ground" onclick = ""></menuitem> <menuitem label = "Q/A" onclick = ""></menuitem> </menu> </div> <script> function display() { alert("The context menu will be visible now."); } </script> </body> </html>
- Related Articles
- Execute a script when a context menu is triggered in HTML5?
- Execute a script when the element is invalid in HTML?
- Execute a script when the element is finished loading in HTML?
- Execute a script when the element is being dragged in HTML?
- Execute a script when the element is being clicked in HTML?
- Execute a script when the element loses focus in HTML?
- Execute a script when the element gets focus in HTML?
- Execute a script when the element is being double-clicked in HTML?
- Execute a script when the dragged element is being dropped in HTML?
- Execute a script when the cue changes in a element in HTML?
- Execute a script when a mouse button is released over an element in HTML?
- Execute a script when the element gets user input in HTML?
- Execute a script when a mouse pointer moves over an element in HTML?
- Execute a script when a mouse wheel is being scrolled over an element in HTML?
- Execute a script when a mouse button is pressed down on an element in HTML?

Advertisements