admin管理员组文章数量:1420095
I was wondering if I can make a button or a div tag only visible/invisible when the user is browsing with IE. I want to achieve that because I have Microsoft JScript runtime error: Access is denied. in IE when the user clicks on a button which triggers hidden asp fileupload control.
EDIT: I have asp button :
<asp:LinkButton ID="btnSavePhoto" runat="server"></asp:LinkButton>
and file upload control with class="hidden" (dysplay: none;):
<asp:FileUpload ID="uploadPhotoDialog" class="hidden" runat="server"/>
The idea is: when the user is browsing with IE - make fileupload visible and link button hidden.
I was wondering if I can make a button or a div tag only visible/invisible when the user is browsing with IE. I want to achieve that because I have Microsoft JScript runtime error: Access is denied. in IE when the user clicks on a button which triggers hidden asp fileupload control.
EDIT: I have asp button :
<asp:LinkButton ID="btnSavePhoto" runat="server"></asp:LinkButton>
and file upload control with class="hidden" (dysplay: none;):
<asp:FileUpload ID="uploadPhotoDialog" class="hidden" runat="server"/>
The idea is: when the user is browsing with IE - make fileupload visible and link button hidden.
Share Improve this question edited Jul 20, 2012 at 8:13 Anton Belev asked Jul 20, 2012 at 7:55 Anton BelevAnton Belev 13.7k23 gold badges74 silver badges115 bronze badges 1- Please learn how to accept answers ... if you have no idea what I'm talking about click here - This is your 3rd Question and you have not yet accepted an answer for any of them ... – Manse Commented Jul 20, 2012 at 8:09
3 Answers
Reset to default 7Use conditional ments :
<!--[if IE]>
<div></div> // this is IE
<![endif]-->
or if not IE
<!--[if !IE]> -->
<div></div> // this is NOT IE
<!-- <![endif]-->
Documentation here
Update
Using your ASP markup do the following :
<!--[if !IE]> -->
<asp:LinkButton ID="btnSavePhoto" runat="server"></asp:LinkButton>
<!-- <![endif]-->
<!--[if IE]>
<asp:FileUpload ID="uploadPhotoDialog" runat="server"/>
<!-- <![endif]-->
No need for the class
attribute then
Target everything except ie..
<!--[if !IE]><!-->
Your button goes here
<!--<![endif]-->
You can add a class for your <html>
element using conditional ments:
<!--[if IE]><html class="ie"><![endif]-->
<!--[if !IE]><!--><html><!--<![endif]-->
and then, assuming this button has a class .mybutton
, you can target it like this
.ie .mybutton {display: none;}
And then you can use the same kind of targeting if you need to style anything else differently in IE.
本文标签: javascriptHow can I make a button hidden only when the user is browsing with IEStack Overflow
版权声明:本文标题:javascript - How can I make a button hidden only when the user is browsing with IE - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745326824a2653630.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论