//Note: 0 is completely transparent, 1 is completely opaque.
//see if browser is IE
msie=false;
if (navigator.appName== "Microsoft Internet Explorer") msie=true;
function setOpacity( id, value){
var e = document.getElementById(id); //store object reference in e
if(msie) e.style.filter = 'alpha(opacity='+ value * 100 + ')'; // for IE
else e.style.opacity= (value); //all other browsers
}
Monday, May 10, 2010
JavaScript set Opacity
Setting opacity in JavaScript is very simple - except for a bunch of crap you have to add for Internet Explorer to work.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment