当前位置 : 主页 > 网络编程 > 其它编程 >

jquery封装的对话框简单实现

来源:互联网 收集:自由互联 发布时间:2023-07-02
jquery封装的对话框简单实现:代码如下:var_alert_iconCsstipmsg_icoInfo;var_confirm_iconCsstipmsg_icoConfirm 代码如下: var _alert_icOnCss= "tipmsg_icoInfo"; var _confirm_icOnCss= "tipmsg_icoConfirm"; var _error_icOnCss= "tipmsg
jquery封装的对话框简单实现:代码如下:var_alert_iconCsstipmsg_icoInfo;var_confirm_iconCsstipmsg_icoConfirm 代码如下:

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 }); }
上一篇:借助LVS+Keepalived实现负载均衡
下一篇:没有了
网友评论