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

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
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More JavaScript Tutorials at LearnPHP.org

Add comments to "Stop Right Mouse Clicks"

Only registered users can write comment

Reader's comments
comments Reiven November 22, 2005 says:
Stop Right Mouse Clicks
You can also go to View>Source (in IE) and view the source.
As for this tutorial - it provides only basic protection.
comments Leyrson November 16, 2005 says:
Stop Right Mouse Clicks
: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