Foros del Web » Programando para Internet » Javascript »

Help !

Estas en el tema de Help ! en el foro de Javascript en Foros del Web. tengo este buscador en javascript, al realizar una busqueda (supongamos de"index.php") los resultados se muestran en una ventana nueva, hasta ahi todo bien, pero el ...
  #1 (permalink)  
Antiguo 03/03/2002, 05:27
Avatar de ||Dj||  
Fecha de Ingreso: enero-2002
Mensajes: 2.349
Antigüedad: 22 años, 3 meses
Puntos: 1
Help !

tengo este buscador en javascript, al realizar una busqueda (supongamos de"index.php") los resultados se muestran en una
ventana nueva, hasta ahi todo bien, pero el problema que en esa misma ventana se va a ver el contenido de los resultados,
y no en "index.php" como yo quiero...en definitiva busco hacer algo similar al buscador de forosdelweb
(abajo dejo el script)
saludos y gracias totales.
  #2 (permalink)  
Antiguo 03/03/2002, 05:28
Avatar de ||Dj||  
Fecha de Ingreso: enero-2002
Mensajes: 2.349
Antigüedad: 22 años, 3 meses
Puntos: 1
Re: Help !

<!-- Begin
var item = new Array();

c=0; item[c]=new Array("index.php","","Dem oSite","index,main,start,home,front&quot ;,"Demonstration search engine data about an imagined but probable internet site.");

page="<html><head><title>Re sultados de la búsqueda</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>";


function search(frm) {
win = window.open("","","scroll bars, WIDTH=340,HEIGHT=225");
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 += (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>Documentos encontrados: "+total+"<br></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> Score: "+num+"<br>";
line += item[which][4] + "<br>"+link+"</td></tr>";
wind.document.write(line);
return 1;
}
// End -->
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 04:11.