简体   繁体   English

无法理解如何使用javascript和jquery代码执行此操作

[英]Can't understand how to do it with javascript and jquery code

Sorry guys for asking that dumb question but I have problem with that thing. 抱歉,您问的这个愚蠢的问题,但我对此事有疑问。 Have such script, it should return true or false, but after drawing that html pop-up window and getting response from that methods. 有这样的脚本,它应该返回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" 


                });

I would suggest to use the jQueryUI modal-confiramtion dialog . 我建议使用jQueryUI modal-confiramtion对话框 It just fits your needs, blocks the UI (modal), has a nice layout and works assync (not freezing the script). 它恰好满足您的需求,阻止UI(模态),具有良好的布局并可以异步运行(不冻结脚本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM