I am attempting fade a div in or out depending on the current opacity.
Here is what I have so far.
[code]
function fade(id) {
var div = document.getElementById(id).style;
var start = (div.opacity * 100);
var end = 100;
var timer = 0;
var speed = 500;
if (start >= end) {
for (var i = start; i < end; i–) {
setTimeout(“startFade(” + i + “, ‘” + id + “‘);”, (timer * speed));
timer++;
}
} else if (start < end) {
for (i = start; i >= end; i++) {
setTimeout(“startFade(” + i + “, ‘” + id + “‘);”, (timer * speed));
timer++;
}
}
}
function startFade(opac, id) {
var div = document.getElementById(id).style;
div.opacity = (opac / 100);
div.filter = ‘alpha(opacity=’ + opac + ‘)’;
}
I have narrowed it down to the for loop. I did this by placeing alerts through out the code. Any suggestions as to why the for loop is not being called?
Thanks,
Tom