Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/04/2012, 14:41
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Llenar innerHTML cuando todo esté cargado

la idea es esta
Cita:
<!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>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function fnc() {

var nueva_img = document.createElement('img');
nueva_img.src = 'http://r0k.us/graphics/kodak/kodak/kodim01.png?cache=' + +new Date();
nueva_img.alt = 'nueva';
document.getElementById('cont_img').appendChild(nu eva_img);

nueva_img.addEventListener('load', function() {
alert('cargada');
document.getElementById('antigua').style.display = 'none';
document.getElementById('cont_img').style.display = 'block';
}, false);

}
</script>
</head>
<body>

<form>
<input type="button" onclick="fnc()" value="cargar nueva imagen" />
</form>

<img src="http://jonlabiano.files.wordpress.com/2010/06/normal_daniela20rojas.jpg" id="antigua" />
<div id="cont_img" style="display: none;"></div>

</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}

Última edición por IsaBelM; 10/05/2012 a las 07:03 Razón: sobraba una línea de código