2012-07-02 124 views
2

我想在jquery中创建一个模型对话框。我想为我的按钮打开对话框。目前只要它打开它,它也关闭它。我从来没有告诉它关闭它,但当我点击它打开的按钮,然后立即关闭。任何想法为什么?jquery对话框打开/关闭

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title></title> 
</head> 

<body> 
<form id="form1" runat="server"> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> 
<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js" type="text/javascript"></script> 
<script src="http://jquery-ui. googlecode.com/svn/tags/latest/external/jquery. bgiframe-2.1.2.js" type="text/javascript"></script> 
<script src="http://jquery-ui. googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script> 

<asp:Button ID="rejctbutton" runat="server" Text="Reject" /> 
<div id="rejectiondiv"> 
<h3> 
Reason of Rejection for Insurance Claim 
</h3> 
<h4> 
This will email the borrower the reason for the rejection. 
</h4> 
<asp:Label ID="rejectLabel" runat="server" Text="Reason"></asp:Label> 
<asp:TextBox ID="rejectTB" runat="server"></asp:TextBox> 
</div> 

<script type="text/javascript"> 
$("#rejectiondiv").dialog({ autoOpen: false, modal: true }) 
$("#rejctbutton") 
.button() 
.click(function() { 
$("#rejectiondiv").dialog("open"); 

}); 
</script> 
</form> 
</body> 
</html> 

回答

1

尝试$('#rejectdiv')。dialog('open');

+0

这样做的事情。打开它,然后立即关闭它 – auwall12688

0
$("#rejctbutton") 
.button() 
.click(function() { 
$("#rejectiondiv").dialog("open"); 
return false; 
}); 

也许这会有所帮助。我发现这个解决方案的另一个回复:

modal-close-question