'onContextMenu' Example : onContextMenu : Event onMethod : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  Event onMethod   » [  onContextMenu  ]   
 



'onContextMenu' Example

Please note that some example is only working under IE or Firefox.

    
<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.java2s.com/style/logo.png" 
         alt="www.java2s.com" 
         width="99" 
         height="76">
</body>
</html>
If you want to disable the context menu, 
add the following code to the <body>:
oncontextmenu="function2(); return false;"
      
      
Related examples in the same category








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.