DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

�键�弊

02.22.2006
| 2247 views |
  • submit to reddit
        // description of your code here

function KeyDown(){ 
//�蔽鼠标�键�Ctrl+n�shift+F10�F5刷新�退格键
//alert("ASCII代�是:"+event.keyCode);
  if ((window.event.altKey)&&
      ((window.event.keyCode==37)||   //�蔽 Alt+ 方�键 �
       (window.event.keyCode==39))){  //�蔽 Alt+ 方�键 →
     alert("�准你使用ALT+方�键�进或�退网页�");
     event.returnValue=false;
     }
  if ((event.keyCode==8)  ||                 //�蔽退格删除键
      (event.keyCode==116)||                 //�蔽 F5 刷新键
      (event.keyCode==112)||                 //�蔽 F1 刷新键
      (event.ctrlKey && event.keyCode==82)){ //Ctrl + R
     event.keyCode=0;
     event.returnValue=false;
     }
  if ((event.ctrlKey)&&(event.keyCode==78))   //�蔽 Ctrl+n
     event.returnValue=false;
  if ((event.shiftKey)&&(event.keyCode==121)) //�蔽 shift+F10
     event.returnValue=false;
  if (window.event.srcElement.tagName == "A" && window.event.shiftKey) 
      window.event.returnValue = false;  //�蔽 shift 加鼠标左键新开一网页
  if ((window.event.altKey)&&(window.event.keyCode==115)){ //�蔽Alt+F4
      window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
      return false;}
}