View Full Version : Fading in and out

09-08-2011, 01:08 AM
Not done any coding for a LONG time. I want to get the value of the opacity for a element.

I'm using Nightly 9.0a1. Also, from what I have read Firefox should us this to SET the opacity style:

obj.style.opacity = opacity/100;

But this does not see to work in the CSS. In the CSS the value ranges from 0 to 1. So 50% would be 0.5

My current function stops working before executing the alert command. I'm guessing i'm trying to get the style value wrong?

function fadeByid(objId) {
if (document.getElementById) {
obj = document.getElementById(objId);
opacity = obj.style.opacity;
if (opacity >= 100) {
setOpacity(obj, opacity);
opacity -= 10;
window.setTimeout("fadeByid('"+objID+"','"+opacity+")", 100);