Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/05/2011, 08:43
cesarnorte9
 
Fecha de Ingreso: diciembre-2010
Ubicación: Alicante
Mensajes: 74
Antigüedad: 14 años, 2 meses
Puntos: 3
Respuesta: Caso Excepcional

Cita:
Iniciado por IsaBelM Ver Mensaje
te falta entrecomillarlo
Gracias por tu respuesta pero no es necesario ya que funciona en el resto con el resto de imagenes.

El fallo lo he encontrado despues de estar toda la mañana probando....
Es un fallo de tiempo de carga...
Al haber tantas imagenes en la página cuando se alcanza el script todavia no se han cargado algunas imagenes...Aunque esté este al final...Por eso todavia no sabe el script el tamaño de dicha imagen...La solucion es hacer un SetTimeOut antes de todo...
O
añadir la llamada a la funcion desde el onload antes de darle visibilidad completa a la páginna....
Codigo Final....
Código:
<script type="text/javascript" >


function Imagen()
{
var img;
<%
'NOS MOVEMOS AL PRINCIPIO Y VOLVEMOS A CALCULAR LAS NOTICIAS POR PÁGINA.
if  not rs.eof then
	rs.MoveFirst
	rs.PageSize=not_por_pagina
	numpaginas=rs.PageCount
	rs.AbsolutePage= pagina
end if

i=0
'EN CASO QUE ESTEMOS EN UNA PÁGINA ID SOLO MOSTRAMOS ESTÁ'
if not isEmpty(Request.QueryString("id")) then
%>
	var ids;
	ids="<% response.Write(rs("foto"))%>";
	img=document.getElementById(ids);
	if(img.width>500)
		img.width=500;
<%
'SI NO HEMOS LLEGADO AL FINAL DE LA BASE DE DATOS SEGUIMOS RECOGIENDO'
elseif not rs.eof then
	%>
	<!--CREAMOS EL ARRAY-->
	var ids=new Array(5);
	var j;
	<%
	do while i<5
			%>
			ids[<%response.Write(i)%>]="<% response.Write(rs("foto"))%>";
			<%
			i=i+1 
		rs.MoveNext
	loop

%>
<!--REDIMENSIONAMOS GRACIAS A ESTE FOR-->
for (j=0;j<ids.length;j++)
{
	if(ids[j]!="")
	{ 
	
	img=document.getElementById(ids[j]);
	if (img.width>500)
		img.width=500;
	}
}
<%
'EN CASO DE QUE HAYAMOS LLEGADO A UN ARTICULO QUE ES EL ULTIMO MOVEMOS AL ANTERIOR'
else
rs.MovePrevious
%>
var ids;
ids="<% response.Write(rs("foto"))%>";
img=document.getElementById(ids);
	if(img.width>500)
		img.width=500;
<%
end if 
%>
}
</script>