By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

Problem with opacity in IE

P: 7
Hi,

I am applying opacity for a division using javascript like this,

[HTML]<head>
<script type="text/javascript">
function setOpacity()
{
document.getElementById("myDiv").style.opacity = ".20";
}
</script>
</head>

<body onLoad="setOpacity()">
<!--div id="myDiv" style="filter:alpha(Opacity:30); -moz-opacity:.30; opacity:.30;"-->
<div id="myDiv">
<img src="My Pictures/Google Talk Received Images/resizable.jpg">
</div>
</body>
</html>

[/HTML]It is working fine in FF but it is not working in IE.
What I have to add for this to make it work in IE?
If any body knows the solution most welcome, it is most helpful for me.
Thank you in advance.

Regards,
Jagadeesh.
Nov 14 '07 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
opacity (the standard) doesn't work in IE. You have to use proprietary filters:
Expand|Select|Wrap|Line Numbers
  1. elem.filter = "alpha(opacity=20)";
Nov 14 '07 #2

P: 7
Hi,

I am trying to get the opacity value of a division using the javascript statement,

"var opacity = document.getElementById("divId").style.opacity;"

It is working fine in Mozilla but not in IE.
What I have to use here to get the opacity value in IE.
If any one knows the solution in this regard, most welcome.

Thank you in advance.

Regards,
Jagadeesh.
Dec 17 '07 #3

acoder
Expert Mod 15k+
P: 16,027
You'll have to use the filter property.

PS. Threads merged.
Dec 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.