Jquery -- 快捷键

来源:互联网 发布:云计算通俗讲义第二版 编辑:程序博客网 时间:2024/06/05 02:36

document.onkeydown = function(event) {
      
          if(event.keyCode == 13){//enter
               $("#getinfoBtn").click(enterClick);
              return false;//屏蔽刷新
          }else if (event.keyCode == 116) { //F5
               $("#addrescodeBtn").click();
              return false;//屏蔽
           }else if(event.keyCode==117){//F6
              $("#updrescodeBtn").click();
              return false;//屏蔽
           }else if(event.keyCode==118){//F7
               $("#delrescodeBtn").click(F7Click);
              return false;//屏蔽
           }else if(event.keyCode==119){//F8
              $("#pnlscrBtn").click(F8Click);
              return false;//屏蔽
           }
       };

 

 

 

 function enterClick() {
  allclear();
  //$("#reacodeGrd").jqGrid("clearGridData");
  $("#shtidGrd").jqGrid("clearGridData");
  var crrid = $.trim($("#crridTxt").val());
  if (crrid== "") {
   showOPIErrorDialog(7003005);
   return false;
  }
  var inTrxObj = {
   trx_id : CPIQCRRD_Q,
   crr_id : crrid     
  }
  var outTrxObj = comTrxSubSendPostJson(inTrxObj);
  if (outTrxObj.rtn_code == "0000000") {
   if (typeof(outTrxObj.eqpt_id) != "undefined")
     {
   if (outTrxObj.eqpt_id != "" && outTrxObj.eqpt_id.substring(0, 1) != "$") {
    var inTrxObj = {
     trx_id  : CPINQEQP_Q       ,
     eqpt_id : outTrxObj.eqpt_id
    }
    var outTrxObj1 = comTrxSubSendPostJson(inTrxObj);
    if (outTrxObj1.rtn_code == "0000000") {
     if(outTrxObj1.eqpt_typ == 'X' || outTrxObj1.eqpt_typ == 'U')
     {
      showOPIErrorDialog(7004048 );
      return false;
     }
    }
   }
    }
   $("#crrinfoTbl_0_sp").text(outTrxObj.crr_id);
   $("#crrinfoTbl_1_sp").text(outTrxObj.lot_id);
   $("#crrinfoTbl_2_sp").text(outTrxObj.splt_id);
   $("#crrinfoTbl_3_sp").text(outTrxObj.crr_stat);
   $("#crrinfoTbl_4_sp").text(outTrxObj.sht_cnt);
   $("#crrinfoTbl_5_sp").text(outTrxObj.pnl_cnt);
   $("#crrinfoTbl_6_sp").text(outTrxObj.pnl_sht_cnt);
   $("#crrinfoTbl_7_sp").text(outTrxObj.route_id);
   $("#crrinfoTbl_8_sp").text(outTrxObj.route_ver);
   $("#crrinfoTbl_9_sp").text(outTrxObj.ope_no);
   $("#crrinfoTbl_10_sp").text(outTrxObj.ope_id);
   $("#crrinfoTbl_11_sp").text(outTrxObj.ope_ver);
   $("#crrinfoTbl_12_sp").text(outTrxObj.proc_id);
   $("#crrinfoTbl_13_sp").text(outTrxObj.eqpt_id);
   $("#crrinfoTbl_14_sp").text(outTrxObj.pep_lvl);
   $("#crrinfoTbl_15_sp").text(outTrxObj.recipe_id);
   setGridInfo(outTrxObj.oary1,shtidGrd);
  }
 }

 

 

在JS/com/dialogs /comKeyBoard.js

$(document).ready(function KeyDown(){
        var KeyObject = function(keyCode){
  this.keyCode = keyCode;
     }
     var filterKeys = [
                   new KeyObject(13),//Enter
                   new KeyObject(112),//F1
                   new KeyObject(113),
                   new KeyObject(114),
                   new KeyObject(115),
                   new KeyObject(116),// F5刷新  ,
                   new KeyObject(117),
                   new KeyObject(118),
                   new KeyObject(119),
                   new KeyObject(120),
                   new KeyObject(121),
                   new KeyObject(122),
                   new KeyObject(123) //F12
                 //  new KeyObject(83, true)// Ctrl+S 
 ];
         window.onhelp=function(){
          return false;
         }//屏蔽F1帮助
        document.onkeydown=function(event){
        for (var i = 0, len = filterKeys.length; i < len; i++) {
           var fk = filterKeys[i];
            
              if(event.keyCode==fk.keyCode){
              if (navigator.userAgent.indexOf("MSIE") > 0){
                  event.keyCode=0;
                  event.returnValue=false;
               }else { 
                 event.preventDefault();  //阻止网页打开
                 event.stopPropagation();
             }
            }
              //屏蔽Ctrl+A
              if(event.ctrlKey&&event.keyCode==65){
                 event.preventDefault();  //阻止网页打开
                 event.stopPropagation();
              }
              if(event.altKey&&event.keyCode==13){
               event.preventDefault();  //阻止网页打开
                 event.stopPropagation();
              }
          }
         }
      })