3 回答

TA貢獻(xiàn)1966條經(jīng)驗(yàn) 獲得超4個(gè)贊
您應(yīng)該能夠解決它。更正是在單擊事件的按鈕的對(duì)話(huà)框選項(xiàng)的設(shè)置器中。
$(document).ready(function() {
? ? $("#dialog").dialog({
? ? ? ? modal: true,
? ? ? ? bgiframe: true,
? ? ? ? width: 500,
? ? ? ? height: 200,
? ? ? ? autoOpen: false
? ? });
? ? $(".lb").click(function(e) {
? ? ? ? e.preventDefault();
? ? ? ? var theHREF = $(this).attr("href");
? ? ? ? $("#dialog").dialog('option', 'buttons', {
? ? ? ? ? ? "Confirm" : function() {
? ? ? ? ? ? ? ? window.location.href = theHREF;
? ? ? ? ? ? },
? ? ? ? ? ? "Cancel" : function() {
? ? ? ? ? ? ? ? $(this).dialog("close");
? ? ? ? ? ? }
? ? ? ? });
? ? ? ? $("#dialog").dialog("open");
? ? });
});
希望這對(duì)其他人有所幫助,因?yàn)楸疚淖畛跏刮易呱狭苏_的軌道,我認(rèn)為我最好發(fā)布更正。

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超5個(gè)贊
我為jquery ui確認(rèn)對(duì)話(huà)框創(chuàng)建了自己的函數(shù)。這是代碼
function myConfirm(dialogText, okFunc, cancelFunc, dialogTitle) {
$('<div style="padding: 10px; max-width: 500px; word-wrap: break-word;">' + dialogText + '</div>').dialog({
draggable: false,
modal: true,
resizable: false,
width: 'auto',
title: dialogTitle || 'Confirm',
minHeight: 75,
buttons: {
OK: function () {
if (typeof (okFunc) == 'function') {
setTimeout(okFunc, 50);
}
$(this).dialog('destroy');
},
Cancel: function () {
if (typeof (cancelFunc) == 'function') {
setTimeout(cancelFunc, 50);
}
$(this).dialog('destroy');
}
}
});
}
現(xiàn)在在您的代碼中使用它,只需編寫(xiě)以下內(nèi)容
myConfirm('Do you want to delete this record ?', function () {
alert('You clicked OK');
}, function () {
alert('You clicked Cancel');
},
'Confirm Delete'
);
繼續(xù)。
- 3 回答
- 0 關(guān)注
- 510 瀏覽
添加回答
舉報(bào)