C# 可在IE8中单击带有警报的禁用按钮(Asp.net网站中的浏览器兼容性问题)
我禁用了一个链接按钮和图像按钮(位于链接按钮内,以便显示警报),它在Chrome中工作正常,但当我在IE8中打开它时,图像被禁用,但当我单击它时,它会显示弹出窗口(“你确定要删除此用户吗?”)。为什么我会在IE8和IE7中出现这个错误,我如何修复这个错误C# 可在IE8中单击带有警报的禁用按钮(Asp.net网站中的浏览器兼容性问题),c#,javascript,asp.net,ie8-compatibility-mode,C#,Javascript,Asp.net,Ie8 Compatibility Mode,我禁用了一个链接按钮和图像按钮(位于链接按钮内,以便显示警报),它在Chrome中工作正常,但当我在IE8中打开它时,图像被禁用,但当我单击它时,它会显示弹出窗口(“你确定要删除此用户吗?”)。为什么我会在IE8和IE7中出现这个错误,我如何修复这个错误 <asp:LinkButton ID="lnk_DeleteUser" Enabled="false" ToolTip="Delete" runat="server" OnClientClick="return co
<asp:LinkButton ID="lnk_DeleteUser" Enabled="false"
ToolTip="Delete" runat="server"
OnClientClick="return confirm('Are you sure you want to delete this User?')">
<asp:ImageButton ID="Img_del" Enabled="false"
src="Styles/Images/icon_delete.png"
OnClick="imgbtn_UserDeleteClick"
runat="server" Style="border-style: none" alt="Delete User" /></asp:LinkButton>
查看源代码:
<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>
为什么不将
图像按钮的用途与链接按钮
合并?(或反之亦然……)
我通过使用图像中的弹出按钮解决了这个问题[学到了一个新东西,HTML没有链接的禁用属性]不管什么原因,服务器都没有在
元素上添加“禁用”属性。(在有自己的“点击”处理程序的
中有一个带有“点击”处理程序的图像按钮真的有意义吗?)您的代码是不可编译的,您需要修复关闭标记我想显示一个图像,在点击图像时,它必须显示一个弹出窗口,要求用户确认,因为return confirm()将使用链接按钮,而不是图像按钮我必须使用linkOnClick=“imgbtn\u UserDeleteClick”中的图像按钮,但未执行,仅显示确认弹出窗口
<asp:LinkButton runat="server" ID="lBtnDeleteUser" OnClick="lBtnDeleteUser_Click"
OnClientClick='return confirm("Are you sure you want to delete this User?")'
style="display: block; background-image: url('Styles/Images/icon_delete.png');
width: widthOficon_delete.pngInPixels; height: heightOficon_delete.pngInPixels;"
ToolTip="Delete" />
<asp:ImageButton ID="Img_del" runat="server" Text="Delete" ImageUrl="Styles/Images/icon_delete.png"
AlternateText="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");' OnClick="imgbtn_UserDeleteClick"/>