zoukankan      html  css  js  c++  java
  • 让easyui 的alert 消息框中的确定按钮支持空格键

    var _messager = $.extend({},$.messager);
    $.extend($.messager,{
    alert:function(title, msg, icon, fn){
    var win = _messager.alert.call(this,title,msg,icon,fn);

    win.on('keyup',function(e){
    if(e.which ==32){
    win.window('close');
    if (fn){
    fn();
    return false;
    }
    }
    });

    },
    confirm: function(title,msg,fn){
    var win = _messager.confirm.call(this,title,msg,fn);
    win.on('keyup',function(e){
    if(e.which ==32 || e.which ==13){
    win.window('close');
    if (fn){
    fn(true);
    return false;
    }
    }

    if(e.which == 27) { // esc
    win.window('close');
    if(fn){
    fn(false);return false;
    }
    }
    });
    },
    prompt:function(title,msg,fn){
    var win = _messager.prompt.call(this,title,msg,fn);
    win.on('keyup',function(e){
    if(e.which ==13){
    win.window('close');
    if (fn){
    fn($('.messager-input', win).val());
    return false;
    }
    }

    if(e.which == 27) { // esc
    win.window('close');
    if(fn){
    fn();return false;
    }
    }
    });
    }
    });
  • 相关阅读:
    sh_04_第1个函数改造
    sh_03_第1个函数
    sh_02_快速体验
    sh_01_九九乘法表
    11_测试模块
    sh_12_转义字符
    sh_11_九九乘法表
    sh_10_嵌套打印小星星
    Mariadb/Redis数据库
    部署django项目
  • 原文地址:https://www.cnblogs.com/hxling/p/4371683.html
Copyright © 2011-2022 走看看