Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/06/2008, 07:55
Avatar de gabrielos
gabrielos
 
Fecha de Ingreso: febrero-2005
Mensajes: 31
Antigüedad: 20 años
Puntos: 0
problema con fade out

Hola a todos, tengo un problema con este codigo, el fade in funciona perfecto pero el fade out no, me podrian dar una mano? Gracias !

Código:
<html>
<head>

<script language="javascript">
//fades layer in
ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac = 0;

function fadein() {
if(opac!= 100){
opac+=1;
if(ie5) document.getElementById('nameoflayer').filters.alpha.opacity = opac;
if(ns6) document.getElementById('nameoflayer').style.MozOpacity = opac/100;
setTimeout('fadein()', 2);
}
}

function fadeOut() {
if(opac!= 0){
opac+=1;
if(ie5) document.getElementById('nameoflayer').filters.alpha.opacity = opac;
if(ns6) document.getElementById('nameoflayer').style.MozOpacity = opac/0;
setTimeout('fadeOut()', 2);
}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
</script>
</head>

<body>
<div onClick="MM_callJS('fadein()')">fadein</div>
<div onClick="MM_callJS('fadeOut()')">fadeout</div>

<div id="nameoflayer" style="position:absolute; left:100px; top:150px; width:100px; height:100px; clip:rect(0,100,100,0); filter: alpha(opacity=0); -moz-opacity:0; background-color:red; z-index:1">
</div>

</body>
</html>
__________________
tumba design