您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jquery封装的对话框简单实现_jquery

2024/5/6 11:19:58发布20次查看
复制代码 代码如下:
var _alert_iconcss = tipmsg_icoinfo;
var _confirm_iconcss = tipmsg_icoconfirm;
var _error_iconcss = tipmsg_icoerror;
var _warning_iconcss = tipmsg_icowarning;
function dialoginit(type, msg) {
var iconcss = ;
switch (type) {
case confirm : iconcss = _confirm_iconcss; break;
case error : iconcss = _error_iconcss; break;
case warning : iconcss = _warning_iconcss; break;
default : iconcss = _alert_iconcss; break;
}
var htmlstr = + msg +
;
return htmlstr;
}
function alert(msg, okcallback) {
var title = 提示;
var type = alert;
var html = dialoginit(type, msg);
var div = $(body).find(#+type+div);
div.remove();
$('body').append($(html));
var buttons = {确定 : function () {
if(okcallback) okcallback();
$(this).dialog(close);
}
};
$(#+type+div).dialog({
modal : true,
title : title,
buttons : buttons
});
}
function confirm(msg, okcallback, cancelcallback) {
var title = 确认;
var type = confirm;
var html = dialoginit(type, msg);
var div = $(body).find(#+type+div);
div.remove();
$('body').append($(html));
var buttons = {确定 : function () {
if(okcallback) okcallback();
$(this).dialog(close);
},
取消 : function () {
if(cancelcallback) cancelcallback();
$(this).dialog(close);
}
};
$(#+type+div).dialog({
modal : true,
title : title,
buttons : buttons
});
}
function error(msg, okcallback) {
var title = 错误;
var type = error;
var html = dialoginit(type, msg);
var div = $(body).find(#+type+div);
div.remove();
$('body').append($(html));
var buttons = {确定 : function () {
if(okcallback) okcallback();
$(this).dialog(close);
}
};
$(#+type+div).dialog({
modal : true,
title : title,
buttons : buttons
});
}
function warning(msg, okcallback) {
var title = 警告;
var type = warning;
var html = dialoginit(type, msg);
var div = $(body).find(#+type+div);
div.remove();
$('body').append($(html));
var buttons = {确定 : function () {
if(okcallback) okcallback();
$(this).dialog(close);
}
};
$(#+type+div).dialog({
modal : true,
title : title,
buttons : buttons
});
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product