Foros del Web » Programando para Internet » ASP Clásico »

Busco un buscador como este

Estas en el tema de Busco un buscador como este en el foro de ASP Clásico en Foros del Web. -----elcorteingles.es/vinos/buscador/buscadorAvanzado.asp-------- habra algo asi avanzado ? saludos...
  #1 (permalink)  
Antiguo 29/03/2009, 10:48
(Desactivado)
 
Fecha de Ingreso: marzo-2009
Mensajes: 4
Antigüedad: 16 años, 1 mes
Puntos: 0
Busco un buscador como este

-----elcorteingles.es/vinos/buscador/buscadorAvanzado.asp-------- habra algo asi avanzado ? saludos
  #2 (permalink)  
Antiguo 29/03/2009, 13:17
Avatar de Shiryu_Libra
Colaborador
 
Fecha de Ingreso: febrero-2007
Ubicación: Cantando "Screenager" en "Kirafa Kaput"
Mensajes: 3.614
Antigüedad: 18 años, 1 mes
Puntos: 88
Respuesta: Busco un buscador como este

mmm.... avanzado??

no se si te has dado cuenta pero.... la forma avanzada que tiene el sitio que has puesto
no es otra cosa que un formulario con mas opciones de busqueda que incluso tu podrias realizar

podrias decir que intentas realizar y con que estas batallando que no te sale?
__________________
"Eres parte del problema, parte de la solucion o parte del paisaje"
Un Saludo desde Desierto de Altar, Sonora, MX.
Shiryu_libra
  #3 (permalink)  
Antiguo 29/03/2009, 15:24
(Desactivado)
 
Fecha de Ingreso: marzo-2009
Mensajes: 4
Antigüedad: 16 años, 1 mes
Puntos: 0
Respuesta: Busco un buscador como este

este es el codigo


BUSCADO ASP

<html>

<head>
<title>BUSCADOR</title>
</head>

<body>

<div align="center">
<center>
<form method="GET" action="resultados.asp">
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="58%" id="AutoNumber1">
<tr>
<td width="104%" align="right" style="border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#000000" colspan="2">
<p align="center"><b><font face="Arial" size="2" color="#FFFFFF">Buscador
Avanzado sobre una BD</font></b></td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<b><font face="Arial" size="2">Título:</font></b></td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<font face="Arial"><input type="text" name="titulo" size="20"></font></td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<b><font face="Arial" size="2">Artista:</font></b></td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<font face="Arial"><input type="text" name="artista" size="20"></font></td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<b><font face="Arial" size="2">Año:</font></b></td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<font face="Arial"><input type="text" name="anio" size="5"></font></td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<b><font face="Arial" size="2">Ordenar resultados por:</font></b></td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="269" id="AutoNumber2" height="71">
<tr>
<td width="20" style="border-style: none; border-width: medium" height="18">
<font face="Arial"><input type="radio" value="titulo" name="orden"></font></td>
<td width="49" style="border-style: none; border-width: medium" height="18">
<font face="Arial" size="2">Titulo</font></td>
<td width="20" style="border-style: none; border-width: medium" height="18">
<font face="Arial">
<input type="radio" value="artista" name="orden" checked></font></td>
<td width="55" style="border-style: none; border-width: medium" height="18">
<font face="Arial" size="2">Artista</font></td>
<td width="20" style="border-style: none; border-width: medium" height="18">
<font face="Arial"><input type="radio" value="tracks" name="orden"></font></td>
<td width="105" style="border-style: none; border-width: medium" height="18">
<font face="Arial" size="2">Tracks</font></td>
</tr>
<tr>
<td width="20" style="border-style: none; border-width: medium" height="16">
<font face="Arial"><input type="radio" value="anio" name="orden"></font></td>
<td width="49" style="border-style: none; border-width: medium" height="16">
<font face="Arial" size="2">Año</font></td>
<td width="20" style="border-style: none; border-width: medium" height="16">
<font face="Arial"><input type="radio" value="precio" name="orden"></font></td>
<td width="55" style="border-style: none; border-width: medium" height="16">
<font face="Arial" size="2">Precio</font></td>
<td width="20" style="border-style: none; border-width: medium" height="16"></td>
<td width="105" style="border-style: none; border-width: medium" height="16"></td>
</tr>
<tr>
<td width="269" style="border-style: none; border-width: medium" colspan="6" height="12">
<font size="1"> </font></td>
</tr>
<tr>
<td width="20" style="border-style: none; border-width: medium" height="17">
<input type="radio" name="alf" value="asc" checked></td>
<td width="124" style="border-style: none; border-width: medium" height="17" colspan="3">
ascendente</td>
<td width="20" style="border-style: none; border-width: medium" height="17">
<input type="radio" name="alf" value="desc"></td>
<td width="105" style="border-style: none; border-width: medium" height="17">
descendente</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<b><font face="Arial" size="2">Cantidad de resultados:</font></b></td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#EBEBEB">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" id="AutoNumber3">
<tr>
<td width="22" style="border-style: none; border-width: medium">
<font face="Arial">
<input type="radio" value="10" name="cantidad" checked></font></td>
<td width="34" style="border-style: none; border-width: medium">
<font face="Arial" size="2">10</font></td>
<td width="20" style="border-style: none; border-width: medium">
<font face="Arial"><input type="radio" value="20" name="cantidad"></font></td>
<td width="35" style="border-style: none; border-width: medium">
<font face="Arial" size="2">20</font></td>
<td width="20" style="border-style: none; border-width: medium">
<font face="Arial"><input type="radio" value="30" name="cantidad"></font></td>
<td width="147" style="border-style: none; border-width: medium">
<font face="Arial" size="2">30</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="39%" align="right" style="border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium" bgcolor="#EBEBEB"> </td>
<td width="65%" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium" bgcolor="#EBEBEB">
<font face="Arial"><input type="submit" value="Buscar"></font></td>
</tr>
</table>
</form>
</center>
</div>

</body>

</html>
  #4 (permalink)  
Antiguo 29/03/2009, 15:26
(Desactivado)
 
Fecha de Ingreso: marzo-2009
Mensajes: 4
Antigüedad: 16 años, 1 mes
Puntos: 0
Respuesta: Busco un buscador como este

Y ESTE ES RESULTADO ASP

<%
Dim mostrar 'cantidad de registros a mostrar por página
Dim cant_paginas 'cantidad de páginas que recibimos
Dim pagina_actual 'La página que mostramos
Dim registro_mostrado 'Contador utilizado para mostrar las páginas
Dim I 'Variable Loop
titulo = request.querystring("titulo")
artista = request.querystring("artista")
anio = request.querystring("anio")
orden = request.querystring("orden")
alf = request.querystring("alf")
cantidad = request.querystring("cantidad")
if cantidad="10" then
mostrar = 10
elseif cantidad="20" then
mostrar = 20
elseif cantidad="30" then
mostrar = 30
end if
if orden = "" then
response.redirect "buscador.asp"
end if

' IF para saber que página mostrar
If Request.QueryString("page") = "" Then
pagina_actual = 1
Else
pagina_actual = CInt(Request.QueryString("page"))
End If

strsql = "SELECT * FROM listado where UCase(titulo) like '%" & UCase(Request("titulo")) & "%' AND UCase(artista) like '%" & UCase(Request("artista")) & "%' AND UCase(anio) like '%" & UCase(Request("anio")) & "%' order by "& orden & " "&alf

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("listacd.mdb")

' creo el RecordSet y defino la cantidad de registros a mostrar
Set RS = Server.CreateObject("ADODB.Recordset")
RS.PageSize = mostrar
RS.CacheSize = mostrar

' Abro la tabla...
RS.Open strSQL, oConn,3,1
'cuento las páginas que se formaron con la variable mostrar
cant_paginas = RS.PageCount

' Si el pedido de página cae afuera del rango,
' lo modifico para que caiga adentro
If pagina_actual > cant_paginas Then pagina_actual = cant_paginas
If pagina_actual < 1 Then pagina_actual = 1
%>
<body style="background-color: #FFFFF4">
<%
' Si la cantidad de páginas da 0 es que no hay registros... por eso este IF
If cant_paginas = 0 Then%>

<p><font face="Arial">Se encontraron <font color="#FF0000"> <b>0</b> resultados</font></font></p>

<ul>
<li><font face="Arial"><a href="buscador.asp">Buscar nuevamente</a></font></li>
<li><font face="Arial">
<a href="resultados.asp?orden=Artista&titulo=<%=titul o%>&cantidad=10">Repetir la búsqueda sin restricciones</a></font></li>
</ul>
<%
'sino, si es que encuentra registros
Else
' Nos movemos a la página elegida
RS.AbsolutePage = pagina_actual
' muestra el dato de la página en la que estamos...
%>
<div align="center">
<center>
<table border="1" cellspacing="1" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="80%" id="AutoNumber1">
<tr>
<td width="29%" bgcolor="#CCCCFF" style="border-left:medium none #111111; background-color: #DDDDFF; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:none; border-bottom-width:medium" align="center">
<p style="text-align: left"><b><font color="#003366" face="Arial" size="2">
Artista </font></b></td>
<td width="36%" bgcolor="#CCCCFF" style="border-style: none; border-width: medium; background-color: #DDDDFF; text-align:center">
<font color="#003366" face="Arial" size="2"><b>Título</b></font></td>
<td width="13%" bgcolor="#CCCCFF" style="border-style: none; border-width: medium; background-color: #DDDDFF" align="center">
<p align="center"><font color="#003366" face="Arial" size="2"><b>Tracks</b></font></td>
<td width="10%" bgcolor="#CCCCFF" style="border-style: none; border-width: medium; background-color: #DDDDFF" align="center">
<p align="center"><font color="#003366" face="Arial" size="2"><b>Año</b></font></td>
<td width="18%" bgcolor="#CCCCFF" style="border-right:medium none #111111; background-color: #DDDDFF; border-left-style:none; border-left-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:none; border-bottom-width:medium" align="center">
<p align="center" style="text-align: center">
<font color="#003366" face="Arial" size="2"><b>Precio</b></font></td>
</tr>
<%

' Hacemos el bucle mostrando los datos del registro
registro_mostrado = 0
Do While registro_mostrado < mostrar And Not RS.EOF
if colorfila = 0 then
color= "#FFFFFF"
colorfila=1
else
color="#F3F3F3"
colorfila=0
end if
%>

<tr>
<td width="29%" style="border-style:none; border-width:medium; background-color: <%= color %>; "><font face="Arial" size="2"><b><%=RS("artista")%></b> </td>
<td width="36%" style="border-style:none; border-width:medium; background-color: <%= color %>; text-align:left; "><font face="Arial" size="2"><%=RS("titulo")%></a></font> </td>
<td width="13%" align="center" style="border-style:none; border-width:medium; background-color: <%= color %>; text-align:center; "><font face="Arial" size="2"><%=RS("tracks")%> </td>
<td width="10%" align="center" style="border-style:none; border-width:medium; background-color: <%= color %>; text-align:center; "><font face="Arial" size="2"><%=RS("anio")%> </td>
<td width="18%" align="center" style="border-style:none; border-width:medium; background-color: <%= color %>; text-align:center; ">
<p><font face="Arial" size="2" color="#FF0000">$<%=RS("precio")%> </td>
</tr>
<%
' Sumamos 1 a los mostrados
registro_mostrado = registro_mostrado + 1
' Nos movemos al próximo registro...
RS.MoveNext
Loop

End If
%>
</table>

</center>
</div>

<%
' Cerramos y limpiamos...
RS.Close
Set RS = Nothing
oConn.Close
Set oConn = Nothing
%>
<div align="center"><br>
<font size="2" face="Arial">
<%
' Ahora mostramos los enlaces a las otras páginas con el resto de los registros...
If pagina_actual > 1 Then
%> </font><font size="2"> <a href="resultados.asp?eje=30&page=<%= pagina_actual - 1 %>&titulo=<%=titulo%>&artista=<%=artista%>&orden=< %=orden%>&anio=<%=anio%>&cantidad=<%=cantidad%>">
<font face="Arial">[</font><b><font face="Arial"><<</font></b><font face="Arial"> anterior ]</font></a><font face="Arial"> <%
End If

' mostramos la paginacion por numeros de página
For I = 1 To cant_paginas
If I = pagina_actual Then
%> <font color="#FF3300">
<b><%= I %></b></font>
<%
Else
%>
<a href="resultados.asp?eje=30&page=<%= I %>&titulo=<%=titulo%>&artista=<%=artista%>&orden=< %=orden%>&anio=<%=anio%>&cantidad=<%=cantidad%>">< %= I %></a>
<%
End If
Next 'I

If pagina_actual < cant_paginas Then
%> </font> <a href="resultados.asp?eje=30&page=<%= pagina_actual + 1 %>&titulo=<%=titulo%>&artista=<%=artista%>&orden=< %=orden%>&anio=<%=anio%>&cantidad=<%=cantidad%>">
<font face="Arial">[ </font>
</font>

<font size="2" face="Arial"> siguiente
</font>

<font size="2">
<b><font face="Arial">>></font></b></font><font face="Arial" size="2">]</font></a><font size="2">
<br>
</font>

<%
End If
'Fin
%>
</div>

<br><center><font face="Arial" size="1"><a href="buscador.asp">Buscar de nuevo</font><font size="2"><a/>
</a></font>

</BODY>
</HTML>

lo que intento es reemplazar los campos de textos de busqueda por combobox , como el ejemplo pero no me ha salido
  #5 (permalink)  
Antiguo 30/03/2009, 04:40
Avatar de Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 3 meses
Puntos: 126
Respuesta: Busco un buscador como este

Hola

Un combo se puede montar dinámicamente (sacas los valores de la bd) o manualmente

Manualmente

Código html:
Ver original
  1. <option value ="1">1</option>
  2. <option value ="2">2</option>
  3. <option value ="3">3</option>

Dinámicamente
Código asp:
Ver original
  1. conexión bd
  2.  
  3. consulta tabla
  4.  
  5. <select>
  6. <%
  7. do while not rs.eof
  8. %>
  9. <input value="<%=rs.fields("campo")%>"><%=rs.fields("campo")%></option>
  10. <%
  11. rs.movenext
  12. loop
  13. %>
  14. </select>

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:33.