js 禁止copy、禁止Ctrl、禁止shift、禁止alt、禁止快
来源:自学PHP网
时间:2014-09-19 14:47 作者:
阅读:次
[导读] 本文章来给大家介绍常用的禁止copy、禁止Ctrl、禁止shift、禁止alt、禁止快捷菜单、禁止右键代码,有需的朋友可进入参考。...
代码如下 |
复制代码 |
function iEsc(){ return false; }
function iRec(){ return true; }
function DisableKeys() {
if(event.ctrlKey || event.shiftKey || event.altKey) {
window.event.returnValue=false;
iEsc();}
}
document.ondragstart=iEsc;
document.onkeydown=DisableKeys;
document.oncontextmenu=iEsc;
if (typeof document.onselectstart !="undefined")
document.onselectstart=iEsc;
else{//camnpr.com
document.onmousedown=iEsc;
document.onmouseup=iRec;
}
//禁止右键
function DisableRightClick(www_camnpr_com){
if (window.Event){
if (www_camnpr_com.which == 2 || www_camnpr_com.which == 3)
iEsc();}
else if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false;
iEsc();}
} |
|