**DONOTDELETE**
(Unregistered)
Sun Jul 27 2003 08:50 AM
Re: Disable right click

The following javascript in your source code will bring up an alert box when the user right-clicks:

Alt = "PUT YOUR ALERT WARNING IN HERE";
IsNS = navigator.appName=="Netscape"
IsIE = navigator.appName=="Microsoft Internet Explorer"
Ver = parseInt(navigator.appVersion)
function DoIt(a) { if (IsNS&&a.which>1) { alert(Alt); return false }
else if (IsIE&&(event.button >1)) { alert(Alt); return false; } }
document.onmousedown = DoIt;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (IsNS&&Ver<5) window.onmousedown = DoIt;

This code (unlike may others) will also work when the visitor holds down the left mouse button when right-clicking.

The following meta tag will get rid of the image toolbar (put it in the head of your document):

<meta http-equiv="imagetoolbar" content="no">

You can see them in action at http://www.lakelandscape.co.uk

Hope this helps.

Michael Sayles


Contact Us | Privacy statement Main website
Hitwise Top 10 Award Winner - Jan-Mar 2005

About us | Contact us | Link to us | Terms & Conditions | Privacy Policy
© Copyright IPC Media Limited, All rights reserved