topical media & game development

talk show tell print

#javascript-code-12-setOpacity.js / js



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


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.