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

opacity error on ie

P: 43
Hello so i got error with opacity this script works on ff and opera but not on ie6 can any one help me? i tryded this filter:alpha(opacity=50); but it didin't work :(

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2. var go_time = 10;
  3. var opacity = 1;
  4. var time = 10;
  5. function fadediv() { 
  6.     if(opacity != go_time) {
  7.         opacity += 1;
  8.         document.getElementById("sample").style.opacity = opacity / go_time;
  9.         setTimeout("fadediv()",time); 
  10.     } else {
  11.         opacity = 1;
  12.     }
  13. }
  14.  
  15. </script>
  16.  
  17. <div id="sample">MY FADING TEXT IN HERE</div>
  18. <button onClick="fadediv()">Fade Div</button>
  19.  
Jan 12 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
For IE, you will have to use filters as you've tried.

One other quirk/bug is that the element has to 'have layout' for opacity to work in IE. So, if you give it a width/height, it should work.
Jan 12 '08 #2

Post your reply

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