Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2009, 11:37
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años, 9 meses
Puntos: 839
Respuesta: clonar style de un elemento html???

Tal vez así:
Código Javascript:
Ver original
  1. function clonar(from, to) {
  2.     for (estilo in from.style) {
  3.         try {
  4.             to.style[estilo] = from.style[estilo];
  5.         } catch(err) {
  6.            
  7.         }
  8.     }
  9. }
Código HTML:
Ver original
  1. <div id="padre" style="background:#f00;color:#fff;">padre</div>
  2. <div id="hijo" style="background:#00f;">hijo</div>
  3. <input type="button" value="clonar" onclick="clonar(document.getElementById('padre'), document.getElementById('hijo'));">
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.