禁用网站右键单击 [英] Disable Right Click in website
本文介绍了禁用网站右键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码禁用右键单击。当您点击右键时,它表示功能被禁用。哪个有效,但是我希望它在你点击右键时没有显示任何事情没有任何反应......我们可以使用什么样的魔法来做到这一点?
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")
推荐答案
只需删除提醒:
if (event.button==2){ return false; } }
这篇关于禁用网站右键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文