You are here: irt.org | FAQ | JavaScript | Event | Q1274 [ previous next ]
Try:
<head> <script language="JavaScript1.1"><!-- var debug = true; function left(e) { if (navigator.appName == 'Netscape' && (e.modifiers & Event.SHIFT_MASK) && (e.which == 1)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && window.event.shiftKey && (event.button == 1)) { alert('Denied'); return false; } if (debug) alert('Allowing mousedown event to proceed...'); return true; } document.onmousedown=left; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=left; //--></script> </head> <body> <!-- place your content after this line --> <p> <img src="picture.gif" width="100" height="100"> </p> <p> some text </p> <p> <a href="somewhere.htm">text link</a> </p> <!-- and before this line --> <script language="JavaScript1.1"><!-- // to prevent shift-left click on images include: for (var i=0; i<document.images.length; i++) document.images[i].onmousedown=left; // to prevent shift-left click on links include: for (var i=0; i<document.links.length; i++) document.links[i].onmousedown=left; //--></script> </body> </html>