Ciao a tutti,
come da titolo mi servirebbe un aiutino per correggere questo script che sono riuscito a far funzionare su FF ma non su IE dove ottengo l'errore js "filters.alpha è nullo o non è un oggetto".. ma non riesco a capire perchè..
codice:
var browserdetect = null;
function increaseOpacity(image){
clearTimer();
obj = image;
setOpacity(obj,0);
highlighting = setInterval("fade(obj,1)",50);
}
function decreaseOpacity(image){
browserdetect = ( image.filters ) ? "ie" : typeof image.style.MozOpacity == "string" ? "mozilla" : "";
clearTimer();
obj = image;
setOpacity(obj,100);
highlighting = setInterval("fade(obj,0)",50);
}
function setOpacity(obj,value) {
if ( browserdetect == "mozilla" )
obj.style.MozOpacity = value/100;
else if ( browserdetect == "ie" )
obj.filters.alpha.opacity = value;
}
function clearTimer(){
if ( window.highlighting )
clearInterval(highlighting);
}
function fade(obj,in_out){
if ( in_out == 1 ) {
if ( browserdetect == "mozilla" && obj.style.MozOpacity < 1 )
obj.style.MozOpacity = Math.min(parseFloat(obj.style.MozOpacity)+0.1, 0.99);
else if ( browserdetect == "ie" && obj.filters.alpha.opacity < 100 )
obj.filters.alpha.opacity += 10;
else
clearTimer();
}
else {
if ( browserdetect == "mozilla" && obj.style.MozOpacity > 0 )
obj.style.MozOpacity = Math.max(parseFloat(obj.style.MozOpacity)-0.1, 0.00);
else if ( browserdetect=="ie" && obj.filters.alpha.opacity > 0 )
obj.filters.alpha.opacity -= 10;
else
clearTimer();
}
}
Il js lo utilizzo in questo modo:
codice:
[img]img.jpg[/img]
Grazie a tutti!