Ver Mensaje Individual
  #9 (permalink)  
Antiguo 29/06/2006, 15:58
thunder.scripts
 
Fecha de Ingreso: febrero-2005
Mensajes: 670
Antigüedad: 19 años, 2 meses
Puntos: 0
¿¿Un iframe?? ughh...
Por lo que entendí, tu script carga una imagen (presumo generada dinamicamente) distinta de acuerdo a la resolución del usuario. De no tener javascript activado, carga una imagen por defecto.

Entonces, lo que sugerimos antes es que insertes la imagen por defecto y la reemplaces por la dedicada a cada resolución usando JavaScript. De esta forma la imagen siempre está, y sólo cambia si tienen JavaScript activado.

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Untitled Document</title>
	<script type="text/javascript">
	/*<![CDATA[*/
		window.onload = function() {
			document.getElementById('goarrow').src = 'http://augustino.net/IMA/?resolucion='+screen.width+'&amp;id=goarrow';
		}
	/*]]>*/
	</script>
</head>

<body>
	<div><img src="http://augustino.net/IMA/?resolucion=800&amp;id=goarrow" alt="PONÉ ALGO ACÁ POR FAVOR, ALGO CON SIGNIFICADO :D" id="goarrow" /></div>
</body>
</html> 
El único problema es que hasta que se cargue toda la página no va a cambiar la imagen. Para solucionarlo, podrías poner el script directamente debajo del div (sin el evento, sólo la asignación):

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Untitled Document</title>
</head>

<body>
	<div><img src="http://augustino.net/IMA/?resolucion=800&amp;id=goarrow" alt="PON&Eacute; ALGO AC&Aacute; POR FAVOR, ALGO CON SIGNIFICADO :D" id="goarrow" /></div>
	<script type="text/javascript">
	/*<![CDATA[*/
		document.getElementById('goarrow').src = 'http://augustino.net/IMA/?resolucion='+screen.width+'&amp;id=goarrow';
	/*]]>*/
	</script>
</body>
</html> 
Personalmente prefiero la primer forma, más aún colocando el JS en un archivo externo y linkeándolo. Pero bueno, a veces el efecto debe ser instantáneo y hay que ensuciar un poco el html (quizás haya otra forma de hacerlo, no se me ocurre como) :(

Suerte
Fede
__________________
Federico H. García
Desarrollo Web
www.federicog.com.ar

Última edición por thunder.scripts; 29/06/2006 a las 16:12