JS 屏蔽刷新,屏蔽右键

  1. // 屏蔽刷新代码  
  2. document.οnkeydοwn=function()  
  3. {  
  4.     if ((window.event.keyCode==116) || //屏蔽 F5   
  5.         (window.event.keyCode==122) || //屏蔽 F11   
  6.         (window.event.shiftKey && window.event.keyCode==121) //shift+F10   
  7.        )  
  8.     {  
  9.         window.event.keyCode=0;   
  10.         window.event.returnValue=false;   
  11.     }  
  12.     if ((window.event.altKey)&&(window.event.keyCode==115)) { //屏蔽Alt+F4   
  13.         window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");   
  14.         return false;   
  15.     }  
  16. }  
  17. // 屏蔽右键   
  18. if (window.Event)  
  19.     document.captureEvents(Event.MOUSEUP);   
  20. function nocontextmenu() {  
  21.     event.cancelBubble = true;  
  22.     event.returnValue = false;   
  23.     return false;   
  24. }  
  25. function norightclick(e) {  
  26.     if (window.Event) {  
  27.         if (e.which == 2 || e.which == 3)  
  28.             return false;   
  29.     }  
  30.     else  
  31.         if (event.button == 2 || event.button == 3) {  
  32.             event.cancelBubble = true;  
  33.             event.returnValue = false;   
  34.             return false;  
  35.         }  
  36. }  
  37. document.oncontextmenu = nocontextmenu; // for IE5+   
  38. document.onmousedown = norightclick; // for all others   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值