Javascript Essentials Part 2
by Hiroshi on November 1st, 2008
No Right Click (no alert)
Add this script in body tag:
oncontextmenu="return false" ondragstart="return false" onselectstart="return false"
i.e.
<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
OR
Use the following script in body section of web page anywhere:
<script language=JavaScript> var message=""; function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") </script>
No Right Click With Alert
simply copy the following script into body of page anywhere.
<script language="JavaScript"> var message="Sorry, that function is disabled.\nThis Page Copyrighted and\nImages and Text protected!\nALL RIGHTS RESERVED"; function click(e) { if (document.all) { if (event.button == 2) { alert(message); return false; } } if (document.layers) { if (e.which == 3) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; </script>
No Right Click on Images
Add the following script at the end of page right before
