CSDN博客

img 21aspnet

B/S模式下如何使软件屏蔽系统热键

发表于2004/10/24 23:42:00  2078人阅读

分类: Javascript

public void HideAllFunction(Page page) 
  {
   if(!page.IsStartupScriptRegistered ("msgHideAllFunction"))
   {
    string clientScript=@"<script language=JavaScript>
                   
          function KeyDown(){   
            if ((window.event.altKey)&& ((window.event.keyCode==37)||(window.event.keyCode==39)))  //屏蔽 Alt+ 方向键 ←  //屏蔽 Alt+ 方向键 →
            {
               
             event.returnValue=false;
            }
            if (event.keyCode==116) //屏蔽 F5 刷新键
            {         
             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 (event.keyCode==122)//屏蔽 F11
            {
             event.keyCode=0;
             event.returnValue=false;
            }
           }

           function nocontextmenu()
            {
            event.cancelBubble = true
            event.returnValue = false;

            return false;
            }
          document.onkeydown = KeyDown;
          document.oncontextmenu=nocontextmenu;
          
          
   
         </script>";

    page.RegisterStartupScript("msgHideAllFunction",clientScript);
   }


  }

阅读全文
0 0

相关文章推荐

img
取 消
img