0

我正在使用“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>

分区标签

<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"  />

干杯

4

1 回答 1

1

Try this

    $("input[id$='btDelete']").click(function() {  
        $.blockUI({ message: $('#question'), css: { width: '620px' } }); 
        return false;
    });

And your button without the OnClientClick. You already have a client-click event above. The return false will stop the event bubbling and prevent the submit of the asp.net button.

于 2012-05-04T14:08:55.210 回答