Foros del Web » Programando para Internet » Javascript »

Ayuda con buscador interno

Estas en el tema de Ayuda con buscador interno en el foro de Javascript en Foros del Web. Hola necesito algo de ayuda ya que me estoy volviendo loco.... estoy con este buscador interno y el problema es que cuando busca el resultado ...
  #1 (permalink)  
Antiguo 08/09/2010, 15:16
Avatar de alfoner  
Fecha de Ingreso: abril-2009
Mensajes: 146
Antigüedad: 15 años
Puntos: 0
Ayuda con buscador interno

Hola necesito algo de ayuda ya que me estoy volviendo loco....
estoy con este buscador interno y el problema es que cuando busca el resultado lo muestra en una pagina nueva y lo que necesito es que me lo encuentre en la misma pagina bajo el buscador manteniendo asi el resultado con el buscador arriba. Gracias....

Aqui les dejo....


<script LANGUAGE="Javascript">

var item = new Array();


c=0; item[c]=new Array("","http://www.pruba.nu","prueba1","hola,adios","ei que pasa");
c++; item[c]=new Array("","http://www.prueba.com","prueba2","coche,moto","muchos coches");
c++; item[c]=new Array("","http://www.prueba.es","prueba3","telefono","telefonia movil");



page="<html><head><title>Resultados De La Busqueda</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>";


function search(frm) {
win = window.open("","","scrollbars");
win.document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write("</table><br>Resultados Totales: "+total+"<br><center>Tituloooo</center></body></html>");
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> <br>";
line += item[which][4] + "<br>"+link+"</td></tr>";
wind.document.write(line);
return 1;
}


</script>
</HEAD>


<div style="position: absolute; left: 78px; top: 0px;">

<BODY><center><form method=get action="javascript:void(0)" onsubmit="search(this); return false;"><tr><td>
<input type=text name=srchval value=""><input type=submit value="Buscar"><br><font face="arial, helvetica" size="-2"><a href="http://www.prueba.es" </body></td></tr></form></center>

Etiquetas: interno, buscadores
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 01:33.