Hey Guys,
I have got a javascript code to the internet and i wanted to change it a bit.
I want the same search result if i search for ABC, aBc, ABc or abC.
I am getting result only if i type abc in the search box. Any one to help please?
Here is the code:
var item = new Array();
// "La page","Son adresse","","Titre de la page","Mot clés","Description de la page"
c = 0;
item[c] = new Array("Imea RDC", "", "", "imea, imea, aru, djedi, matthias, ecole, banque, en, ligne, scolaire", "L'institut Mgr Emile Aiti est une institution d'enseignement scolaire qui prone l'education de qualite avant tout le reste...");
c++;
item[c] = new Array(" Voir plus sur la CECA 20 Aru ville ", "", "", "ceca, 20, aru, ville, eglise", "La CECA 20 Aru ville est une eglise de la 20e communaute evangelique en Afrique au Congo, situe a l'exctreme ...");
c++;
item[c] = new Array("", "", "", "", "");
page = "<html><head><title>Résultat de la recherche</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=90%><p>Faire une nouvelle recherche</p>";
function search(frm) {
win = window.open("", "_self", "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>Pages trouvé(s): " + 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> <br>Identifiant: RO/" + num + "<br>";
line += item[which][4] + "<br>" + link + "</td></tr>";
wind.document.write(line);
return 1;
}