2
對不起,如果你問這個愚蠢的問題,但我有問題,那件事。 有這樣的腳本,它應該返回true或false,但在繪製該html彈出窗口並獲得該方法的響應之後。無法理解如何使用javascript和jQuery代碼來做到這一點
$("#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"
});
你正在尋找的是'.confirm()'。看看這個插件:http://nadiana.com/jquery-confirm-plugin – gearsdigital
不要在js代碼中生成內聯HTML,更好地使用模板。 – moonwave99