有的网站页面禁止使用右键和复制功能,甚至连Ctrl键也禁止掉了,这个效果是如何实现的呢?其实很简单就是调用了一段JS代码而已。下面就是实现效果所需代码:function click(e) { if (document.all) { if (event.button==1||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;document.oncontextmenu = new Function("return false;")
var travel=truevar hotkey=17 /* hotkey即为热键的键值,是ASII码,这里99代表c键 */if (document.layers)document.captureEvents(Event.KEYDOWN)function gogo(e){ if (document.layers) {if (e.which==hotkey&&travel){ alert("操作错误.或许是您按错了按键!"); } }else if (document.all){if (event.keyCode==hotkey&&travel){ alert("操作错误.或许是您按错了按键!"); }}}
document.onkeydown=gogo 把上面的代码另存为一个JS文件,然后在想实现此效果的页面调用即可!道高一尺,魔高一丈,这个方法是有相应的破解方法,只攻代码爱好者研究用。