抱歉,您问的这个愚蠢的问题,但我对此有疑问。
有这样的脚本,它应该返回true或false,但是在绘制该html弹出窗口并从该方法获得响应之后。

           $("#pageInfo a.btnDel").click(function () {

                    $("#cmsSmallPopUpWindowMessage").html("<h2>Do you really want to delete this page?</h2><center><div style='width:130px'><ul class='bactions'><li><a id='cmsSmallPopUpWindowBYes' href='javascript:void(0)'><span><span>Yes</span></span></a></li><li><a id='cmsSmallPopUpWindowBNo' href='javascript:void(0)'><span><span>No</span></span></a></li></ul><div class='archor'></div></div></center>");
                    $.blockUI({ message: $("#cmsSmallPopUpWindow"), css: { width: "530px", border: "0px", backgroundColor: "transparent"} });
                    setTimeout(function () {
                        $.unblockUI();
                    }, 6000);


                    $("#cmsSmallPopUpWindowBNo").click(function () {
                        $.unblockUI();
                        return false;
                    });


                    $("#cmsSmallPopUpWindowBYes").click(function () {
                        $.unblockUI();
                        location.reload();
                        return onDelete($(this).attr('href'));
                    });
                    return true; // this should change for "false" or "true" but after click on "yes" or "no"


                });

最佳答案

我建议使用jQueryUI modal-confiramtion dialog。它恰好满足您的需求,阻止UI(模态),具有良好的布局并可以异步运行(不冻结脚本)。

10-08 08:12