我有一个带有 imageButton 的 Asp.net (Ver4) 网页,用于通过 imagebuttons 单击事件后面的代码将表单数据提交到数据库。在后面的代码中,我使用 response.redirect 将它们移动到感谢页面,它是例程后面代码的最后一行。由于数据库有点慢,有时我想禁用点击事件,直到页面被重定向。我正在尝试用 jquery 来做到这一点。我已经能够禁用该按钮并使其显示为已禁用,但是我背后的代码根本没有触发。
这是我正在使用的 JQuery
function test() {
$("#ImageButton1").attr("disabled", "disabled").css('opacity',' 0.5');
}
这是按钮的 aspx 代码
<div class="button">
<asp:ImageButton ID="ImageButton1" runat="server" Height="28px"
OnClientClick="test();"
onclick="ImageButton1_Click"
ImageUrl="media/finishbutton.jpg"
style="margin-top: 0px" Width="97px" />
</div>