asp.net.ph

Skip Navigation Links

oncontextmenu Event


Fires when the user clicks the right mouse button in the client area.

Syntax

Inline <element oncontextmenu = "handler" ... >
Script object.oncontextmenu = handler JScript™ (compatible with ECMA-262 language specification) only

Remarks

Bubbles Yes
Cancels Yes
To invoke Right-click the object.
Default action Opens the context menu. To cancel the default behavior, set the returnValue property of the event object to FALSE.

Event Object Properties

While event handlers in the Document Object Model do not receive parameters directly, the handler can query the event object for data.

Event Object Properties


Example

This example demonstrates use of the oncontextmenu event to cancel its default action, though the event is typically used to trigger a function that will show a custom menu instead.

Sample Code


Applies To

document


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note