Funktioniert nur im IE (fade) warum?

Hisel

Grünschnabel
Kann mir jemand sagen wie ich das auch im FF zum laufen bekomme:

HTML:
<html>
<head>
<script language="JavaScript">
var i=100;
var aktiv;

function fadeOut(){
    if(i==0) {
        window.clearInterval(aktiv);
    }else{
        i--;
        m1.style.filter="alpha(opacity="+i+")";
    }
}

function fadeIn(){
    m1.style.filter="alpha(opacity=100)";
    i = 100;
}

</script>

<style type="text/css">
<!--
#m1 {
   filter:alpha(opacity=100);
   position:absolute;
   left:50px;
   top:100px;
   background-color: #0033CC;
   border: 1px none #000000;
   }
-->
</style>

</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="m1" onClick="aktiv = window.setInterval(&quot;fadeOut()&quot;,20);">
text test text<br>
<input name="und weg" type="submit">
</div>

</body>
</html>

Danke Hisel
 
Der CSS-Filter alpha(opacity) kommt aus dem Hause Microsoft und wird daher nur vom IE unterstützt.

Das Pendant für die Gecko-Browser wäre -moz-opacity bzw. MozOpacity in JS.
 
OK

Kannst du mir dann auch noch sagen wie der Quelltext aussehen muß, habe keine Ahnung von Javascript....

Ev. mit Browserweiche !?

Thx Hisel
 
Probier mal Folgendes:
Code:
var opacity = 100;
var aktiv;
function fadeOut()
{
	if( opacity <= 0 ) {
		window.clearInterval(aktiv);
	} else {
		i--;
		m1.style.filter = "alpha(opacity=" + opacity + ")";
		m1.style.MozOpacity = opacity / 100;
	}
}

function fadeIn()
{
	opacity = 100;
	m1.style.filter = "alpha(opacity=" + opacity + ")";
	m1.style.MozOpacity = opacity / 100;
}
Ist jedoch ungetestet.
 
Zurück