Tema: split en asp
Ver Mensaje Individual
  #10 (permalink)  
Antiguo 09/04/2004, 06:09
jpalbox
 
Fecha de Ingreso: abril-2002
Mensajes: 432
Antigüedad: 23 años
Puntos: 0
ahi va la solucion

<script language="javascript">

var ventana
var cont=0
var titulopordefecto = " -----" //texto por defecto a mostrar en la barra de título en caso de omitir el argumento titulo
var redir="'contact.asp'"

function afoto(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,sc rollbars=no,width=10,height=10')
ventana.document.write('<html><head><link href="../estiloss.css" rel="stylesheet"><title>' + titulo + '</title>')
ventana.document.write('</head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0" bgcolor="#3366FF" text="#FFFFFF"><center class="b"> <a href="javascript:window.print()" class="b">Print photo</a> | <a href="javascript:window.close();window.opener.loca tion.replace('+ redir +');" class="b" style="cursor:hand">Contact us</a> | <a href="javascript:window.close()" class="b">Close window</a><br><br><center><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">')
ventana.document.close()
cont++
}
function redimensionar(ancho,alto)
{
ventana.resizeTo(ancho+12,alto+60)
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto*1,5)/2)
//centra la ventana. Eliminar si no se quiere centrar el popup
}
</script>
</head>
<%tipo=request.querystring("tipo")
dir="../public/"+tipo+"/"
'Abre la conexion con la base de datos a traves de una conexion ODBC
Set con = Server.CreateObject("ADODB.Connection")
'Como vamos a utilizar la variable rs del tipo recordset para recorrer los registros con EOF
Set rs = Server.CreateObject("ADODB.Recordset")
con.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/mdb-database/propiedad.mdb"))

'Ejecuta un sentencia SQL de consulta
sql = "SELECT * FROM "+tipo+""
rs.Open sql, con,3

'Recorre todas las filas del resultado

Dim arreglo(99,99)

Do While Not rs.EOF
ruta=rs("ruta")
if ruta<>"" then
ele=split(ruta,";")
totalele=ubound(ele)
for ea=0 to totalele
arreglo(e,ea)=ele(ea)
next

if e=0 then
response.write "<table cellpadding='2' border=0 cellspacing='2' class='general'><tr>"
end if
if a=3 then
response.write "</tr><tr>"
a=0
end if

response.write "<td valign='top' align='center'><table style='border: 1 solid #000000' class='general'><tr><td bgcolor=#003399 colspan=2><font class='property'>• "&rs.fields("propiedad")&"</font></td></tr><tr><td>"%><a onClick="afoto(dir2<%=e%>,'<%=rs.fields("propiedad ")%>');return false" style='cursor:hand'><%response.write "<img src='"&dir&arreglo(e,0)&"' name='imag"&e&"2' width='140'></a></td></tr>"

%>
<script>

i<%=e%>=0
dir2<%=e%>="<%=dir&arreglo(e,0)%>"

function pasaimagen<%=e%>(a,b){
i<%=e%>=i<%=e%>+b
if (i<%=e%>==a+1){i<%=e%>=0;}
if (i<%=e%>==-1) {i<%=e%>=a;}
<% for j=lbound(ele) to ubound(ele)-1 %>
if (i<%=e%>==<%=j%>) {
imag<%=e%>2.src="<%=dir&arreglo(e,j)%>"
dir2<%=e%>="<%=dir&arreglo(e,j)%>"
n<%=e%>=i<%=e%>+1
}
<%next%>
}
</script>
<%
if ubound(ele)>1 then
%>
</a>
<table>
<tr>
<td align="center" >
<p align="center" class="f">
<a href="javascript:pasaimagen<%=e%>(<%=ubound(ele)-1%>,-1);" class="f">
<img border="0" src="../images/previous.gif" align="absmiddle"> Previous</a>&nbsp;&nbsp;
<a href="javascript:pasaimagen<%=e%>(<%=ubound(ele)-1%>,1);" class="f">Next
<img border="0" src="../images/next.gif" align="absmiddle"></a> <%
end if
else

if e=0 then
response.write "<table cellpadding='2' border=0 cellspacing='2' class='general'><tr>"
end if
if a=3 then
response.write "</tr><tr>"
a=0
end if

response.write "<td valign='top' align='center'><table style='border: 1 solid #000000' class='general'><tr><td bgcolor=#003399 colspan=2><font class='property'>• "&rs.fields("propiedad")&"</font></td></tr><tr><td class='f' width='140'><center><BR>PHOTO<BR>NO<BR>AVAILABLE<B R><BR></CENTER></td></tr>"

end if%>
</td>
</tr>
</table>

<%
a=a+1
e=e+1
Set ele = Nothing
rs.MoveNext
Loop
'Libera memoria
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing

Última edición por jpalbox; 27/04/2004 a las 04:14