| Author: Kumar Velu 19 Jul 2008 | Member Level: Diamond | Rating: Points: 6 |
Hi,
try like this
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function click(e) { if (document.all) { if (event.button==2||event.button==3) { oncontextmenu='return false';
} }
if (document.layers) { if (e.which == 3) { oncontextmenu='return false'; } } }
if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; function handleKeyDown() { if (window.event.keyCode == 116) { event.keyCode=0; event.returnValue=false; } } document.onkeydown = handleKeyDown; </SCRIPT> </HEAD >
<BODY BGCOLOR="#E0E0E0" TEXT="#000080" oncontextmenu="return false" ondragstart="return false" onselectstart="return false"> U can not right click on this page </BODY>
|
| Author: shanmukha kumari 21 Jul 2008 | Member Level: Gold | Rating: Points: 6 |
Simply add the following code to the <BODY> section of your web page (Press Ctrl C after selecting code to copy it):
<script language=JavaScript> <!--
//Disable right mouse click Script //By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive //For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
/////////////////////////////////// function clickIE4(){ if (event.button==2){ alert(message); return false; } }
function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } }
if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; }
document.oncontextmenu=new Function("alert(message);return false")
// --> </script>
|
| Author: Senthil V 28 Jul 2008 | Member Level: Gold | Rating: Points: 6 |
//for disabling the right click in the webpage document.oncontextmenu=new Function("return true")
var message="Your message here"; function clickIE4(){ if (event.button==2){ alert(message); return false; } }
function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } }
}
if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; }
document.oncontextmenu=new Function("alert(message);return false;")
var omitformtags=["input", "textarea", "select"] omitformtags=omitformtags.join("|")
function disableselect(e) { if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1) return false }
function reEnable() { return true }
if (typeof document.onselectstart!="undefined") document.onselectstart=new Function ("return false") else { document.onmousedown=disableselect document.onmouseup=reEnable }
|