JQueryUI确认框 confirm

$(function(){
    $('#AlertMsg').dialog({
      autoOpen: false,
      width: 300,
      modal: true,
      position: 'center',
      buttons: {
          "确定": function() {
                    $(this).dialog("close");
                  }
      }
   });
   
   $('#ConfirmMsg').dialog({
          autoOpen: false,
          width: 300,
          modal: true,
          position: 'center',
          buttons: {
              "确定": function() {
                           mDialogCallback(true);
                           $(this).dialog('close');
                           
                      },
              "取消": function() {                           
                           mDialogCallback(false);
                           $(this).dialog('close');
                      }              
          }
   });
});

var mDialogCallback;

function ShowMsg(msg, callback) {
     if (callback == null) {
         $('#AlertMsgBody').html(msg);
         $('#AlertMsg').dialog('open');
     }
     else {
         mDialogCallback = callback;
         $('#ConfirmMsgBody').html(msg);
         $('#ConfirmMsg').dialog('open');
     }
 }

 

posted @ 2016-11-07 15:50  甜菜波波  阅读(3515)  评论(0编辑  收藏  举报