Web Programming  Home Web Programming JavaScript Stop Right Mouse Clicks
rss

Stop Right Mouse Clicks

Author: James Bernley More by this author


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!)


Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Read/Add comments to "Stop Right Mouse Clicks"

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
Laughing 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