这是我用来禁用单击按钮时的控件的方法:
$('#cmdbtnreleaseOwner').attr('disabled', true);
$('#cmdlnkbtnreleaseOwner').attr('disabled', true);
这会禁用 IE 中具有相应 ID 的控件,但不适用于 Mozilla FF 和 Chrome。
编辑:
这是我的 Aspx 代码:
<asp:ImageButton ID="cmdbtnreleaseOwner" ClientIDMode="Static" runat="server" ImageUrl="~/images/add-prospect.png" CommandName="Release" OnClientClick="return OnServiceOrderButtonClick();" />
<asp:LinkButton Text="Release OwnerShip" ClientIDMode="Static" runat="server" ID="cmdlnkbtnreleaseOwner" CommandName="Release" OnClientClick="return OnServiceOrderButtonClick();" />
来自 Source 的 HTML:
<input type="image" name="ctl00$ContentPlaceHolder1$ServiceOrderGridView$ctl00$ctl02$ctl00$cmdbtnreleaseOwner" id="cmdbtnreleaseOwner" src="../images/add-prospect.png" onclick="return OnServiceOrderButtonClick();" />
<p>
<a onclick="return OnServiceOrderButtonClick();" id="cmdlnkbtnreleaseOwner" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$ServiceOrderGridView$ctl00$ctl02$ctl00$cmdlnkbtnreleaseOwner','')">Release OwnerShip</a>
</p>