可能重複:
Disabled button with a alert is clickable in IE8 (browser compatibility Issue in Asp.net website)如何改變支持C#disabled屬性爲true
<asp:LinkButton ID="lnk_DeleteUser" ToolTip="Delete User" runat="server" OnClientClick="return confirm('Are you sure you want to delete this User?')">
<asp:ImageButton ID="Img_del" src="Styles/Images/icon_delete.png" OnClick="imgbtn_UserDeleteClick"
runat="server" Style="border-style: none" alt="Delete User" /></asp:LinkButton>
我想禁用鏈接按鈕和圖像按鈕某些條件,但我不能禁用鏈接按鈕,因爲當調試ng我發現支持禁用屬性是false。因爲在IE8中的圖像是禁用的,但鏈接按鈕沒有被禁用,我能夠得到確認彈出窗口。
這是從瀏覽器
<a onclick="return confirm('Are you sure you want to delete this User?');" id="ctl00_MainContent_UserTable_ctl02_lnk_DeleteUser" title="Delete User" class="aspNetDisabled"><input type="image" name="ctl00$MainContent$UserTable$ctl02 $Img_del" id="ctl00_MainContent_UserTable_ctl02_Img_del" disabled="disabled" title="You don't have permission to delete users" class="aspNetDisabled" src="Styles/Images/icon_delete.png" alt="Delete User" src="" style="border-style: none" /></a>
使用服務器端`if`設置屬性。 – SLaks 2011-12-15 15:43:01