Created on 31 Aug 2001; Reformat Oct 2002; Last Edit March 2005
Demonstration of oncontextmenu Event Handler
Works in: IE5+ Windows; Netscape 6.1/Win; Netscape 6.2/Linux; Safari 1.2/Mac; (Mozilla) Firefox 0.8 to 10.1/Mac+Win. Send me a note if you find it works in something else!
Contextual menu = what you get when you right click under Windows: Read more about it http://www.blooberry.com/indexdot/html/tagpages/attributes/oncontextmenu.htm and note that this event is not implemented in all browsers.
<!--code originated by joe crawford www.artlung.com--> <form action="../"> <P> <span oncontextmenu="forms.elements.value++; return false"> When right clicking here, the contextual menu* is disabled. </span> <input type="text" value="0"> </P> <P> <span oncontextmenu="forms.elements.value++"> Here, on the other hand, it's enabled. </span> <input type="text" value="0"> </p> </form>
Comments from Readers
Don't you think the document should have a list of browsers it is known NOT to work in?
Well, I dunno. The intent of the page is just to show the simplest possible implementation. Keeping a table of every browser it doesn't work was not my intention. However, if someone wants to do that work I'll be happy to insert it above.