Mega Code Archive

 
Categories / JavaScript Reference / Event Handlers Reference
 

OnContextMenu Example

<html> <head> <script language="JavaScript">     function function2() {         alert("This image is copyrighted")      } </script> </head> <body oncontextmenu="function2()">     <p>Right click in the image.</p>     <img oncontextmenu="function2()"           src="http://www.rntsoft.com/style/logo.png"           alt=""           width="99"           height="76"> </body> </html> If you want to prevent the user from opening the context menu,  add the following code to the <body> element above: oncontextmenu="function2(); return false;"