一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jquery $.Dialog对话框示例代码

时间:2015-04-01 编辑:简简单单 来源:一聚教程网

效果图:

源代码:


//模态窗口插件
(function ($) {
    $.Dialog = {
        option: {
            title: "dialog",
            height: "300",
            width: "500",
            modal: true,
            resizable: false,
            external: true,
            draggable: true,
            closeandreturn:false
        },
        open: function (url, dlgid, options) {
             
            var op = $.extend({}, $.Dialog.option, options);
            dlgid += new Date().getTime(); // 加入当前时间戳,建立动态ID避免ID冲突
            var tempDialog = document.getElementById(dlgid);
            if (tempDialog != undefined && tempDialog != null) {
                $dialog = $(tempDialog);
            } else {
                $body = $("body");
                $div = $("

");
                $div.attr("id", dlgid);
                $body.append($div);
                $dialog = $("#" + dlgid);
            }
            if (op.external) {
                var iframeWidth = parseInt(op.width) - 10;
                var iframeHeight = parseInt(op.height);
                iframe = $("