Here’s a short snippet to set the opacity of an element:
function setOpacity(e,opacity){
var o=e.style;
o.opacity=(opacity/100); //Opera
o.MozOpacity=(opacity/100); //Mozilla+Firefox
o.KhtmlOpacity=(opacity/100); //Konqueror
o.filter="alpha(opacity="+opacity+")"; //IE
}
Use it like this:
var e=document.getElementById('myElement');
setOpacity(e, 50);//Sets the opacity to 50%
[tags]JavaScript[/tags]