0

我在下面有这段代码来禁用右键单击。当你点击右键时,它说功能被禁用。哪个有效,但我希望它在你点击右键时根本什么都没有显示……我们可以用什么样的魔法来做到这一点?

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") 
4

2 回答 2

2

只需删除警报:

if (event.button==2){ return false; } } 
于 2013-02-02T02:06:33.520 回答
-1
## 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>
于 2014-07-09T20:48:28.533 回答