Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/05/2011, 02:12
cesarnorte9
 
Fecha de Ingreso: diciembre-2010
Ubicación: Alicante
Mensajes: 74
Antigüedad: 13 años, 4 meses
Puntos: 3
Respuesta: Redimensionar imagen con javascript(ASP)

he conseguido crear una funcion para mi caso... Os hago un copy paste....
Código HTML:
<%
'NOS MOVEMOS AL PRINCIPIO Y VOLVEMOS A CALCULAR LAS NOTICIAS POR PÁGINA.

	rs.MoveFirst
	rs.PageSize=not_por_pagina
	numpaginas=rs.PageCount
	rs.AbsolutePage= pagina


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
NUM NOTICIAS ES UN CONTADOR QUE SE INCREMENTA ANTERIORMENETE PARA SABER EL NUMERO DE NOTICIAS DE CADA PAGINA.'
else
		if not rs.eof then
		%>
		var ids=new Array(<%=num_noticias%>);
			var j;
		<%
		else
	
		%>
		var ids=new Array(<%=num_noticias%>);
			var j;
			<%
		end if
		%>
	<!--CREAMOS EL ARRAY-->
	
	<%
	
	do while i<num_noticias
			%>
			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;
	}
}
<%
end if 
%>
}
</script>