首页 > 其他 > 详细

让easyui 的alert 消息框中的确定按钮支持空格键

时间:2015-03-27 14:29:35      阅读:297      评论:0      收藏:0      [点我收藏+]
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;
}
}
});
}
});

 

让easyui 的alert 消息框中的确定按钮支持空格键

原文:http://www.cnblogs.com/hxling/p/4371683.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!