Comunidad de diseño web y desarrollo en internet online

Ayuda buscador interno

Citar            
MensajeEscrito el 26 Oct 2011 05:55 pm
Hola,

Estoy intendando tener un buscador interno para una web. Buscando encontre uno que funciona bien, pero me abria el resultado en un pop up y no lo queria asi, cambiando unas lineas del codigo logre que muestre los resultados en la misma pagina pero en realidad necesito que lo muestra en otra pagina por ejemplo resultados.html . no logro hacerlo. Dejo el codigo para ver si alguien puede ayudarme.

Código :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!---aqui comienza el buscador -->
<script language="JavaScript">
<!-- Begin
var item = new Array();

// "Nombre de la página","Situación página","Título","Palabras clave","Comentarios descriptivos"

/* links below were changed so a 404 error would not be found if someone actually clicked them in the www.js-examples.com database */
c=0; item[c]=new Array("http://www.web.com","","palabra01","palabra02","palabra03");
c++; item[c]=new Array("http://www.web.com/","","palabra01","palabra01","palabra01");


codigo="<h1>Search Results</h1><table border=0 cellspacing=10 width=80%>";

function search(frm) {
win = document.getElementById("resultado");
win.innerHTML=codigo;
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.innerHTML+="</table><center><br><font size=2>Tu busqueda se ha encontrado:"+total+"<br></body></html></font>";
win.innerHTML+="<hr></table><center><br><b><font size=4><big>web.com<br></font><font size=2></head></html></font>";
win.innerHTML+="</table><head><center><br><font size=2>Titulo<br></head></html>";

}
function show(which,wind) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a><br>";
line += item[which][4] ;
wind.innerHTML+=line;

return 1;
}
// End -->
</script>

</font></font></font></font></font><form method="get" action="javascript:void(0)" onsubmit="search(this); return false;">


<center><font size="2"><font size="2"><font color=" #66666"><font size="2"><font color=" #66666"><input name="srchval" value="" size="20" type="text"><input value="BUSCAR" type="submit">
<div id="resultado"></div>
<br>

<!-- fin del buscador -->


Agregando estas dos lineas pude hacer que muestre el resultado en la misma pagina.

Código :

win = document.getElementById("resultado");


abajo del buscador:

Código :

<div id="resultado"></div>


Espero que alguien me ayude. Saludos.

Por Rakin

Claber

140 de clabLevel



 

firefox
Citar            
MensajeEscrito el 01 Nov 2011 12:06 am
Up!

Ninguna ayuda? Alguna otra opcion para hacer un buscador sin base de datos?

Por Rakin

Claber

140 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Mar 2012 07:13 am
Hola que tal!, vi tu buscador y estoy buscando algo asi, he buscado otras opciones pero nada q me ayude. me podras ayudar mostrandome como funciona el tuyo?

Por totti026

1 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.