自己用JQueryUI封装了几个系统常用对话框

/*
 * @功能描述:各种系统消息框
 * @前置插件:JQueryUI
 * @开 发 者:魏巍
 * @开发日期:2015-04-15
 * @version 1.0
 */
var SF = {};
SF.Msg = function () {
    var $msgbox, offTimer;

    var popup = function (_msg) {//自动关闭
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 150,
            resizable: false,
            close: function () {
                $(this).dialog("destroy");
            }
        });
        $msgbox.prev(‘.ui-dialog-titlebar‘).remove();

        clearTimeout(offTimer);
        offTimer = setTimeout(function () {
            $msgbox.dialog("close");
        }, 1000);
    }

    var succeed = function () {//操作成功
        popup("操作成功");
    }

    var alert = function (_msg) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: { "确定": function () { $(this).dialog("close"); } },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    var confirm = function (_msg, _callback) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: {
                "确定": function () {
                    $(this).dialog("close");
                    _callback();
                },
                "取消": function () {
                    $(this).dialog("close");
                }
            },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    return {
        popup: popup,
        succeed: succeed,
        alert: alert,
        confirm: confirm
    }
}();

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。