模态窗口使用示例

//打开模态窗体
    function openSearch() {
        var dt = new Date();
        window.showModalDialog("total_AllSelect.aspx?dt=" + dt.getSeconds(), this, "dialogHeight:400px;dialogWidth:700px;center:yes;status:no;");
    }

 //打开模态窗体,刷新父窗口
     function openSearch(txtId) {
        if (window.showModalDialog("checkYearDetail.aspx?txtId=" + txtId + "", this, "dialogHeight:260px;dialogWidth:360px;center:yes;status:no;") == "ok") {
         //判断如果等于了OK,就执行相应的操作
         $.get("../ashxControl/checkForYear.ashx", { txtPeopId: $("#txtPoperSearch").val() }, function (data) {
                        if (data != null && data != "") {
                            $("#tdBody").html(data);
                            return true;
                        }
                        else {
                            return false;
                        }
                    });
                }

//关闭模态窗口,并传递参数OK
    $("#btnReturn").click(function () {
                window.opener = null;
                window.returnValue = 'ok';
                window.close();
                return false;
            })
原文地址:https://www.cnblogs.com/summers/p/3107737.html