Question

I have this code below to disable right click. When you hit the right click it says Function is disabled. which works but i want it to show nothing at all basicaly when you hit the right click nothing happens... what kind of magic can we use to do that?

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") 
Was it helpful?

Solution

Just remove the alert:

if (event.button==2){ return false; } } 

OTHER TIPS

## How To Disable Right Click with Out Display any thing or Var Massage  ##
<script language=JavaScript>
<!--
var message="";
function clickIE4()
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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top