JavaScript - An open source scripting language, it allows the creation of dynamic web page content.  Home Web Programming JavaScript Stop Right Mouse Clicks

Stop Right Mouse Clicks


Try using your 'Right Mouse Button' on this Page

The code used to make this work is shown below (Cut and Paste between the HEAD tags of your web page):

<script LANGUAGE="JavaScript">
<!--
function click()
{
if (event.button==2)
{
alert('You Can NOT use the Right Mouse Button on this Page, Sorry!');
}
}
document.onmousedown=click
// -->
</script>

(If you change the 'event.button' value to 1 you can stop the left mouse button working!)

Author's URL: James Bernley
JavaScript - An open source scripting language, it allows the creation of dynamic web page content. More JavaScript Tutorials: Featured Materials | Fresh Materials | More JavaScript Tutorials at LearnPHP.org

Reader's comments
comments Reiven November 22, 2005 says:
You can also go to View>Source (in IE) and view the source.
As for this tutorial - it provides only basic protection.

Reply
comments Leyrson November 16, 2005 says:
:lol: but I can other click .. with 2, right and left button, together.
..

right click, over ok botton click with right and left button.. menu appears

good bye

Reply
Add comments to "Stop Right Mouse Clicks"

Captcha