禁止网页使用鼠标左键审查元素的JavaScript代码 [复制链接]

moqu8 2017-11-1

5 0
在任意网页添加如下JS代码,就可以防止用户使用鼠标左键及快捷键审查元素了!当然,不能完全防止!

<script type="text/javascript">
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) { alert("支持正版!!!有需求请与魔趣建站we.moqu8.com联系,谢谢您的合作!!!");
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
document.onkeydown =document.onkeyup = document.onkeypress=function(){ 
if(window.event.keyCode == 123) { 
window.event.returnValue=false;
return(false); 
}
</script>

最新回复 (0)
返回
支持中心
邮箱:winkill2012@qqcom
新站优化中!部分功能尚未完善,敬请谅解!
支持中心