js禁止页面使用右键(简单示例代码)


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


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3