带有警报的禁用按钮在IE8中可单击(Asp.net 网站中的浏览器兼容性问题)

本文关键字:net Asp 网站 浏览器 问题 兼容性 单击 有警 按钮 IE8 | 更新日期: 2023-09-27 18:18:01

我已经禁用了链接按钮和图像按钮(位于链接按钮内,以便我可以显示警报(,它在Chrome中工作正常,但是当我在IE8中打开它时,图像被禁用,但是当我单击它时,它会显示弹出窗口("您确定要删除此用户吗?为什么我在IE8和IE7中收到此错误,如何解决此问题。

  <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(&#39;Are you sure you want to delete this User?&#39;);"
 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&#39;t have permission to delete users" class="aspNetDisabled" 
src="Styles/Images/icon_delete.png" alt="Delete User" src="" 
style="border-style: none" /></a>

带有警报的禁用按钮在IE8中可单击(Asp.net 网站中的浏览器兼容性问题)

为什么不将ImageButton的目的与LinkButton合并呢?(反之亦然...

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

我通过使用图像按钮中的弹出窗口解决了它[学到了HTML没有禁用链接属性的新东西]