ersetze deinen JS Code durch das hier, dann klappts, zumindest in meinem Firefox 2.0.
aber den code kann man dennoch was schöner gestalten... ich hab nur auf die Schnelle die Fehler rausgemacht.
die ganzen this. Variablen sind public. also man kann die auch von außen setzen. Das möchte man bei id sicher nicht. private machst du sie mit var.
function Fader(){
this.opacity = 1;
this.speed = 0.01;
this.stopOpacity = null;
this.id = null;
this.isFadeOut = false;
this.errorMsg = "Ein Fehler";
var newFadeOutOpacity;
var self = this;
var newFadeInOpacity;
this.fadeOut = function (id, stopOpacity) {
this.isFadeOut = true;
this.id = document.getElementById(id);
this.opacity = 1;
this.stopOpacity = stopOpacity;
newFadeOutOpacity = window.setInterval(function(){self.newFadeOut();}, 20);
};
this.newFadeOut = function () {
this.id.style.opacity = this.opacity;
this.opacity = this.opacity - this.speed;
if ( this.opacity <= this.stopOpacity ) {
window.clearInterval(newFadeOutOpacity);
this.id.style.visibility = "hidden";
}
};
this.fadeIn = function (id, stopOpacity) {
if ( this.isFadeOut == false ) {
alert ( this.errorMsg );
} else {
this.id = document.getElementById(id);
this.id.style.visibility = "visible";
this.isFadeOut = false;
this.stopOpacity = stopOpacity;
newFadeInOpacity = window.setInterval (function(){self.newFadeIn();}, 20);
}
};
this.newFadeIn = function () {
this.id.style.opacity = this.opacity;
this.opacity = this.opacity + this.speed;
if( this.opacity >= this.stopOpacity ) {
window.clearInterval( newFadeInOpacity );
}
};
}
var myFader = new Fader();