一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

js 禁止copy、禁止Ctrl、禁止shift、禁止alt、禁止快捷菜单、禁止右键

时间:2013-05-28 编辑:简简单单 来源:一聚教程网

 代码如下 复制代码
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();}
}

热门栏目