Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/07/2011, 04:56
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 10 meses
Puntos: 834
Respuesta: Como hago Para Modificar atributos en style por X Segundos [javascript]

A ver si te sirve:

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Documento sin título</title>
<
script type="text/javascript">
function 
CambiaEstilo(obj,tam,atrib){
        var 
obj document.getElementById(obj);//quitamos el resto: no necesitamos retrocompatibilidad con explorer 4, ¿no?
        
if (atrib=="size")
           
obj.style.height=tam;
        if (
atrib =="top")
            
obj.style.top=tam;
}
//nos aseguramos de que todos los elementos hayan sido reconocidos por el navegador antes de invocarlos (onload)
onload=function(){
    
/*
    -como hay que definir argumentos en la función temporizada, la envolvemos en una función anónima
    -notar que el segundo argumento tiene la unidad px, porque si no hay navegadores que no mostrarán el cambio
    */
    
setTimeout( function(){CambiaEstilo('pp','1000px','size');}, 5000 );
}
</script>

</head>

<body>
<div id="pp" style="width:300px; height:50px; background:#F00;"></div>
</body>
</html>