2011-09-14 95 views
0

我有問題,當我試圖調用頁面中的多個對話框。點擊3個標籤時我有三個錨點標籤,我必須生成具有不同內容的對話框。但是當我點擊第二個標籤時,我得到的是前一個對話框?我如何刷新對話框中的內容?JQuery刷新UI對話框的內容?

我所做的下面

$("a.delete").click(function (event) { 
     DialogBox('#DeleteConfirm'); 
}); 

    $("a.message").click(function (event) { 
      DialogBox('#DeleteConfirm'); 
    }); 

var $dialog = null; function dialog() { 
    // create dialog if not done already 
    if (!$dialog) { 
     $dialog = $("#dialogToShow").dialog({ 
      title: "Confirm Password", 
      closeText: "Cancel", 
      show:"slide", 
      resizable: false, 
      modal: true, 
      autoOpen: false, // this is important! prevent auto open 
      open: function(ev, ui){ 
       $('.ui-widget-overlay').stop().animate({"opacity": "0.40"}, 1480); 
      }, 
      close: function(ev, ui){ 
       $('.ui-widget-overlay').stop().animate({"opacity": "0"}, 1480); 
      }     
     }); 
    } 
    // use the reference to the dialog and call open. 
    $dialog.dialog('open'); 
    return false; } 

給出任何人可以幫助我嗎?

+0

你的DialogBox功能在做什麼?它不在代碼中 – dioslaska

回答

1

,你必須爲每一個案件一個單獨的對話框,然後 - 並分別

打電話給他們,如果我理解正確的話,你應該做的某事。像

$("a.delete").click(function (event) { 
    dialog($('#DeleteDialog'), "Confirm Password"); 
); 

$("a.message").click(function (event) { 
     dialog($('#MessageDialog'), "Message"); 
}); 

function dialog(content, title) { 
    $(content).dialog({ 
     title: title, 
     closeText: "Cancel", 
     show:"slide", 
     resizable: false, 
     modal: true, 
     //autoOpen: false, // this is important! prevent auto open 
     open: function(ev, ui){ 
      $('.ui-widget-overlay').stop().animate({"opacity": "0.40"}, 1480); 
     }, 
     close: function(ev, ui){ 
      $('.ui-widget-overlay').stop().animate({"opacity": "0"}, 1480); 
     }     
    }); 
}