WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 change opacity by function, joan, October 5, 2003
     Re:change opacity by function, mikael, October 6, 2003
         Re:change opacity by function, Erik Arvidsson, October 9, 2003
         Re:change opacity by function, joan, October 6, 2003

Subject: Re:change opacity by function From: Erik Arvidsson Date: October 9, 2003
Just making it more fail safe (Mozilla and CSS3 compatible).

function setOpacity(id, n)
{
var el = document.getElementById(id);
el.style.opacity = n;
el.style.MozOpacity = n;
el.style.filter = "Alpha(Opacity=" + Math.round(n * 100) + ")";
}

n is a value between 0 and 1. I prefer this more than 0 and 100 because it is easier to use. If you prefer it the other way around just edit the function ;-)

erik



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX