禁止copy、禁止Ctrl、禁止shift、禁止alt、禁止快捷菜单、禁止右键
分类:Javascript| 发布:camnprbubuol| 查看:415 | 发表时间:2013/5/6
禁止copy、禁止Ctrl、禁止shift、禁止alt、禁止快捷菜单、禁止右键
代码如下:(建议保存到一个js文件中,例如:nocopy.js)
01 | function iEsc(){ return false ; } |
02 | function iRec(){ return true ; } |
03 | function DisableKeys() { |
04 | if (event.ctrlKey || event.shiftKey || event.altKey) { |
05 | window.event.returnValue= false ; |
08 | document.ondragstart=iEsc; |
09 | document.onkeydown=DisableKeys; |
10 | document.oncontextmenu=iEsc; |
11 | if ( typeof document.onselectstart != "undefined" ) |
12 | document.onselectstart=iEsc; |
14 | document.onmousedown=iEsc; |
15 | document.onmouseup=iRec; |
18 | function DisableRightClick(www_camnpr_com){ |
20 | if (www_camnpr_com.which == 2 || www_camnpr_com.which == 3) |
22 | else if (event.button == 2 || event.button == 3){ |
23 | event.cancelBubble = true |
24 | event.returnValue = false ; |