We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

mifly on 03/13/08


Tagged

javascript


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

MePha
korzhik
joomla


set opacity


Published in: JavaScript 


  1. // Set an opacity level for an element
  2. // (where level is a number 0-100)
  3. function setOpacity( elem, level ) {
  4. // If filters exist, then this is IE, so set the Alpha filter
  5. if ( elem.filters )
  6. elem.filters.alpha.opacity = level;
  7.  
  8. // Otherwise use the W3C opacity property
  9. else
  10. elem.style.opacity = level / 100;
  11. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: mifly on March 17, 2008

Posted By: marcopoloaz06 on March 30, 2008

thx

You need to login to post a comment.