Wednesday, June 13, 2012

JQuery Dialog Box:

Put this in head of the page:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 

Define a div in the body of your page:

<div id="div_message" style="margin:0px;display:none;"></div>

Call this function from where you want to show that dialog box:


function showDialog()
{
 var buttonsParam = {
            "Continue": function(){$("# div_message ").dialog('destroy');}
       };

 $("# div_message ").dialog('destroy');
 //$("# div_message ").html("Your Message");
 $("# div_message ").dialog({
 autoOpen: false,
 resizable: false,
 draggable:true,
 modal:true,
 title: "Alert",
 width:800,
 buttons: buttonsParam
 });
$("a.ui-dialog-titlebar-close").remove();         // this line should be used if you don't want cross in corner.
 $("# div_message ").dialog('open');
}

No comments:

Post a Comment