我正在使用“BLOCKUI”jquery确认对话框插件,它的工作完美,除了它没有重置它加速的按钮,
也许这是一个逻辑错误:/,这是代码,
脚本
<script type="text/javascript" src="/_layouts/1033/jquery.js"></script>
<script type="text/javascript" src="JS.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("input[id$='btDelete']").click(function() {
$.blockUI({ message: $('#question'), css: { width: '620px' } });
});
$("input[id$='yes']").click(function() {
$.blockUI({ message: "" });
});
$("input[id$='no']").click(function() {
$.unblockUI();
return false;
});
});
</script>
Div标记
<asp:Content ID="Content4" ContentPlaceHolderID="cphSubmit" runat="server">
<div id="question" style="display:none; background-color:Menu; cursor: default">
<div align="center">
<br /><asp:Label ID="Label1" runat="server" Text="Deleting this eDecision will remove all site content and uploaded documents.<br />Are you sure you wish to continue?" CssClass="headertext"></asp:Label><br /><br /><br /><br /><br />
<asp:Button ID="yes" Width="200px" Height="25px" CssClass="gradientbutton" OnClick="btDelete_Click" Runat="server" Text="Yes"></asp:Button>
<asp:Button ID="no" Width="200px" Height="25px" CssClass="gradientbutton" Runat="server" Text="No"></asp:Button><br /><br /><br />
</div>
</div>
按钮
<td>
<asp:Button ID="btDelete" runat="server" CssClass="gradientbutton" OnClick="btDelete_Click"
OnClientClick="this.disabled=true;" Text="Delete" Width="200px" />
</td>
如果我将按钮更改为
<asp:Button ID="btDelete" runat="server" CssClass="gradientbutton" Text="Delete" Width="200px" />
出现对话框,然后消失:S
和IF按钮如下所示,对话框出现但是即使我按“否”删除按钮保持禁用状态,
<asp:Button ID="btDelete" runat="server" CssClass="gradientbutton" OnClick="btDelete_Click"
OnClientClick="this.disabled=true;" Text="Delete" Width="200px" />
干杯
答案 0 :(得分:1)
试试这个
$("input[id$='btDelete']").click(function() {
$.blockUI({ message: $('#question'), css: { width: '620px' } });
return false;
});
没有OnClientClick的按钮。您已经有上面的客户端点击事件。返回false将停止事件冒泡并阻止提交asp.net按钮。