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

publicvoidHideAllFunction(Pagepage)   {   if(!
强烈推介IDEA2020.2破解激活,IntelliJ IDEA 注册码,2020.2 IDEA 激活码

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.οncοntextmenu=nocontextmenu;
          
          
   
         </script>";

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

  }

本文来源21aspnet,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/2596

发表评论