我想知道当用户使用IE浏览时,我是否可以使按钮或div标签仅可见/不可见。我想实现这一点,因为我有Microsoft JScript运行时错误:访问被拒绝。在IE中,当用户点击触发隐藏的asp.net fileupload控件的按钮时。
编辑: 我有asp按钮:
<asp:LinkButton ID="btnSavePhoto" runat="server"></asp:LinkButton>
和class =“hidden”的文件上传控件(dysplay:none;):
<asp:FileUpload ID="uploadPhotoDialog" class="hidden" runat="server"/>
这个想法是:当用户使用IE浏览时 - 使文件上载可见并隐藏链接按钮。
答案 0 :(得分:7)
使用条件评论:
<!--[if IE]>
<div></div> // this is IE
<![endif]-->
或者如果不是IE
<!--[if !IE]> -->
<div></div> // this is NOT IE
<!-- <![endif]-->
使用ASP标记执行以下操作:
<!--[if !IE]> -->
<asp:LinkButton ID="btnSavePhoto" runat="server"></asp:LinkButton>
<!-- <![endif]-->
<!--[if IE]>
<asp:FileUpload ID="uploadPhotoDialog" runat="server"/>
<!-- <![endif]-->
不需要class
属性
答案 1 :(得分:3)
除了...之外的目标。
<!--[if !IE]><!-->
Your button goes here
<!--<![endif]-->
答案 2 :(得分:2)
您可以使用条件注释为<html>
元素添加一个类:
<!--[if IE]><html class="ie"><![endif]-->
<!--[if !IE]><!--><html><!--<![endif]-->
然后,假设此按钮具有类.mybutton
,您可以像这样
.ie .mybutton {display: none;}
然后,如果您需要在IE中另外设置其他方式,则可以使用相同类型的定位。