aqui dejo el codigo:
Código HTML :
<!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://misitio.com/papeleria.html","","Basicos","lapiz,pluma,goma,za capuntas","productos basicos"); c++; item[c]=new Array ("http://misitio.com/papeleria2.html","","Basicos 2","resistol,tijeras,regla,escuadra","productos basicos 2"); codigo="<h1>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>se ha encontrado:"+total+"<br></body></html></font>"; } function show(which,wind) { link = item[which][1] + item[which][0]; line = "<tr><td><br><a href='"+link+"'>"+item[which][2]+"</a><br>"; line += item[which][4] ; wind.innerHTML+=line; return 1; } // End --> </script> <form method="get" action="javascript:void(0)" onsubmit="search(this); return false;"> <!-- fin del buscador --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div> <center><font size="15" color=" #66666"><input name="srchval" value="" size="20" type="text"><input value="BUSCAR" type="submit"></font></center></div></form> <div align="center" id="resultado"></div> </body> </html>