zoukankan      html  css  js  c++  java
  • 分析CMMS系统笔记使用js控制快捷键

    使用js控制快捷键

    /**
    * Events are handled for different browsers.
    */
    CalemLogin._handleKeyEvents
    =
    function(event) {
    event
    = event || window.event; //Either passed in or directly from window
    if (event == null) return true;

    var target = event.target ? event.target: event.srcElement; //get the target of the event
    if (!target) return true;

    //Process key presses
    var keyCode = event.keyCode || event.charCode;
    if (keyCode == 13) { // Enter key 点击entry按钮时提交
    if (target.id==CalemLogin.usernameEl) {//Move to password
    document.getElementById(CalemLogin.passwordEl).focus();
    }
    else if ( (target.id==CalemLogin.passwordEl || target.id==CalemLogin.loginEl)
    && document.getElementById(CalemLogin.loginEl).disabled==false) {
    CalemLogin._attemptLogin();
    }
    CalemLogin._cancelEvent(event);
    return false;
    }
    else if (keyCode == 9) { // Tab
    var handled=false;
    var shiftKey = event.shiftKey;
    if (shiftKey) {
    if (target.id==CalemLogin.usernameEl) {
    handled
    =true;
    if (document.getElementById(CalemLogin.loginEl).disabled) {
    //Do no do anything - cannot move on to disabled button.
    } else {
    document.getElementById(CalemLogin.loginEl).focus();
    }
    }
    else if (target.id==CalemLogin.loginEl) {
    document.getElementById(CalemLogin.passwordEl).focus();
    handled
    =true;
    }
    }
    else if (target.id==CalemLogin.loginEl) { //Do not tab into the browser window
    document.getElementById(CalemLogin.usernameEl).focus();
    handled
    =true;
    }
    else if (target.id==CalemLogin.passwordEl
    && document.getElementById(CalemLogin.loginEl).disabled) {
    //Cannot move to disabled
    handled=true;
    }
    if (handled) {
    CalemLogin._cancelEvent(event);
    return false;
    }
    }
    //Not handling here
    return true;
    }

      

  • 相关阅读:
    ASP.Net TreeView递归
    WCF发布到IIS7问题的解决方案 (转)
    NavigationService
    【WPF】如何保存RichTextBox的文本到数据库?以及如何对RichTextBox的Document做绑定? Life Is Art 博客园
    Visibility
    WPF操作RichTextBox(转)
    WCF4.0进阶系列第三章 构建健壮的程序和服务(转)
    TreeView(递归)(转)
    WCF4.0 进阶系列–前言(转)
    递归删除树结构数据
  • 原文地址:https://www.cnblogs.com/bugY/p/2134949.html
Copyright © 2011-2022 走看看