Hello,
Sorry for my bad english, I'm french...
:)
I try to search on this javascript with all the words oh the input...
I don't know how to do it....
Sorry for my bad english, I'm french...
:)
I try to search on this javascript with all the words oh the input...
I don't know how to do it....
<SCRIPT language=javascript>// Script développé par Olivier Hondermarck// D'autres scripts sur http://www.toutjavascript.com// Utilisation gratuite à condition de laisser ces commentaires// Création de la base de donnéesvartjs_base=newTJS_InitBase("_self");// TJS_InitBase(target) : target="_blank" pour ouvrir dans une nouvelle page////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////tjs_base.Add("URL","Ceci est un légume","carotte haricot salade ");tjs_base.Add("URL","<B></B>","");tjs_base.Add("URL","Ceci est un fruit","banane peche orange");////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// COMPLETEZ ICI la base de données// tjs_base.Add(page,titre,mots-clés)String.prototype.sansAccent =function(){varaccent = [/[\300-\306]/g, /[\340-\346]/g,// A, a/[\310-\313]/g, /[\350-\353]/g,// E, e/[\314-\317]/g, /[\354-\357]/g,// I, i/[\322-\330]/g, /[\362-\370]/g,// O, o/[\331-\334]/g, /[\371-\374]/g,// U, u/[\321]/g, /[\361]/g,// N, n/[\307]/g, /[\347]/g,// C, c];varnoaccent = ['A','a','E','e','I','i','O','o','U','u','N','n','C','c'];varstr =this;for(vari =0; i < accent.length; i++){str = str.replace(accent[i], noaccent[i]);}returnstr;}functionTJS_InitBase(target) {this.nb_item=0;this.target=target;this.Add=AddItem;this.Search=SearchItem;}functionAddItem(page,desc,cle) {varnb =this.nb_item;varitem =newObject;item.page=page;item.desc=desc;item.cle=cle;this[nb]=item;this.nb_item++;}functionSearchItem(txt) {// txt contient le texte de la recherche////////////////////////////////////////////////// txtsaisie=txt;// alert( txtsaisie );////////////////////////////////////////////////txt =unescape(txt);////////////////////////////////////////////////txt=txt.sansAccent()//txt.match(/("[^"]*")|([^\s]+)/g);//alert( txt );////////////////////////////////////////////////txt = txt.replace(/\+/g," ");varn=tjs_base.nb_item;varindice=-1;if(txt=="") {alert("Entrez un mot pour la recherche"); }else{document.forms["tjs_search"].elements["mot"].value=txt;/// document.forms["tjs_search"].elements["mot"].value=txtsaisie;varZ="";varnb=0;for(vari=0; i<n; i++) {if(tjs_base[i].cle.toUpperCase().indexOf(txt.toUpperCase(),0)!="-1") {Z+=tjs_base[i].desc +"<BR><A ' href='"+tjs_base[i].page+"'>"+tjs_base[i].page+"</A><BR><BR><table width=800 height=3><tr><td style=\'background-color : #B0E0E6\'></td></tr></table>"nb++;}}if(nb>0) {if(nb==1) {Z="Un résultat trouvé pour la recherche sur [<B>"+txt+"</B>] : <BR><BR><table width=800 height=3><tr><td style=\'background-color : #B0E0E6\'></td></tr></table>"+Z;}else{Z=nb+" résultats trouvés pour la recherche sur [<B>"+txt+"</B>] : <BR><BR><table width=800 height=3><tr><td style=\'background-color : #B0E0E6\'></td></tr></table>"+Z;}}else{Z="Aucun résultat pour la recherche sur [<B>"+txt+"</B>]<BR>Vérifiez l'orthographe ou essayez un autre mot clé !";}document.write(Z);}}functionTJS_Search(f) {if(f.mot.value!=""){f.submit();}}functionTJS_PrintResult() {varurl=document.location.href;if(url.indexOf("?mot=",0) >0) {varmot=url.substring(url.indexOf("?mot=",0)+5);SearchItem(mot);}}</SCRIPT>