Ver Mensaje Individual
  #6 (permalink)  
Antiguo 12/03/2009, 12:33
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Comprobar si imagen existe

Fijate si te sirve:
Código:
<!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=iso-8859-1" />
<title>test</title>
<script>
function manejar(o,i){
	if(typeof i=='undefined')i=0; else i++;
	var pos=['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg'];
	if(pos[i]){
		o.src=pos[i];
		o.onerror=function(){manejar(o,i);}
		document.getElementById('log').innerHTML+='intentando cargar'+pos[i]+'<br />';
	}else{
		document.getElementById('log').innerHTML+='no hay caso';
		//o.parentNode.replaceChild(document.createTextNode('imagen inexistente'),o);
	}
}
</script>
</head>

<body>
<img src="noExisto" onerror="manejar(this)" />
<div id="log"></div>
</body>
</html>