2011-09-14 186 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); 
     }     
    }); 
}