468,244 Members | 1,789 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,244 developers. It's quick & easy.

Problem with opacity in IE

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
3 1800
acoder
16,027 Expert Mod 8TB
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
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
16,027 Expert Mod 8TB
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.

By using this site, you agree to our Privacy Policy and Terms of Use.