if (Total = = links[q]) // occurrence trouve count++; // Increment compteurne veut toujours rien dire
// ================================================= DEBUT FONCTION ( LINKS : Tableau , MotCle : CHAINE) DECLARATION et INITIALISATION Compteur à 0 ECRITURE_DOCUMENT de l'Entête POUR TOUS les Indices du Tableau LINKS SI TROUVE MotCle DANS LINKS.CATEGORIE[Indice en Cours] ALORS ECRITURE_DOCUMENT des Infos du Lien INCREMENTATION du Compteur CONTINU à Indice Suivant FIN SI SI TROUVE MotCle DANS LINKS.DESCRIPTION[Indice en Cours] ALORS ECRITURE_DOCUMENT des Infos du Lien INCREMENTATION du Compteur CONTINU à Indice Suivant FIN SI SI TROUVE MotsCle DANS LINKS.NAME[Indice en Cours] ALORS ECRITURE_DOCUMENT des Infos du Lien INCREMENTATION du Compteur CONTINU à Indice Suivant FIN SI SI TROUVE MotsCle DANS LINKS.URL[Indice en Cours] ALORS ECRITURE_DOCUMENT des Infos du Lien INCREMENTATION du Compteur CONTINU à Indice Suivant FIN SI FIN POUR RETOURNE le Compteur FIN FONCTION
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<html> <head> <script type="text/javascript"> var T_Nombre = [1,2,3,5,2,4,5,6,9,7,3,0]; //------------------------- function Affiche_Nbr( num_){ //-- appel fonction et recup compteur var Nbr = Get_Nombre( num_); //-- Formattage sortie ecran var szTmp = "il y a " + Nbr +" chiffre " +num_ +" dans le tableau!"; //-- Affichage resultat alert( szTmp); } //------------------------- function Get_Nombre( num_){ //-- compteur a zero var count = 0; //-- Parcours du tableau for( var i =0, Max = T_Nombre.length; i < Max; i++){ if( num_ == T_Nombre[i]) // occurrence trouve count++; // Increment compteur } //-- return le compteur return( count); } //-- Appel combien de 5 dans le tableau Affiche_Nbr( 5); </script> </head> </html>
function validate_form() { txt = document.form.search.value; jsi = new makeLinks(linksize); //--------------------------------------------------------- //-- Appel de la fonction searchLinks, //-- en retour Total vaudra le nombre d'occurrence trouvées //--------------------------------------------------------- var Total = searchLinks(jsi, txt); // la suite de la fonction.... }
function validate_form() { text = document.form.search.value; jsi = new makeLinks(linksize); // searchLinks(jsi, text); ==============// LIGNE A SUPPRIMER //== var Total = searchLinks(jsi, text); document.write("<hr>"); document.write("Nouvelle recheche "); }
// La fonction de recherche elle-meme function searchLinks(links, keyword){ //-- compteur a zero var count = 0; //------------------------------------------- // ICI tu fais tes tests et incrémentes count // à chaque fois que tu trouves une occurence //------------------------------------------- //-- En final on retourne le Nbr d'occurence return( count); }
function validate_form() { text = document.form.search.value; jsi = new makeLinks(linksize); var Total = searchLinks(jsi, text); document.write("<hr>"); document.write(Total+"résultats"); document.write("Nouvelle recheche "); } function searchLinks(links, keyword){ var count = 0; for( var i =0, Max = Total.length; i < Max; i++){ if( links == Total[i]) count++; } return( count); }
function validate_form() { text = document.form.search.value; jsi = new makeLinks(linksize); var Total = searchLinks(jsi, text); document.write("<hr>"); document.write(Total+" resultats ") document.write("Nouvelle recheche "); } function searchLinks(links, keyword){ function Get_Nombre( links){ //-- compteur a zero var count = 0; //-- Parcours du tableau for( var i =0, Max = Total.length; i < Max; i++){ if( links == Total[i]) // occurrence trouve count++; // Increment compteur } //-- return le compteur return( count); }
document.write("</table> Pages trouvé(s): "+Total+" </html>");d'après ton script du début.
function searchLinks(links, keyword){ var count = 0; for (var i =0, Max = Total.length; i < Max; i++){ if( links == Total[i]) // occurrence trouve count++; // Increment compteur } //-- return le compteur return( count); }
// La fonction de recherche elle-meme function searchLinks(links, keyword) { // la ligne d'en-tete de la reponse a la base de donnees document.write("[ + links[q].URL + " + links[q].Name + "] "); document.write(links[q].Desc + " "); document.write(" " + links[q].URL + " "); document.write(" "); continue; } if (links[q].Desc.toLowerCase().indexOf(keyword) != -1) { document.write(" "); document.write(" [ + links[q].URL + " + links[q].Name + "] "); document.write(links[q].Desc + " "); document.write(" " + links[q].URL + " "); document.write(" "); continue; } if (links[q].Name.toLowerCase().indexOf(keyword) != -1) { document.write(" "); document.write(" [ + links[q].URL + " + links[q].Name + "] "); document.write(links[q].Desc + " "); document.write(" " + links[q].URL + " "); document.write(" "); continue; } if (links[q].URL.toLowerCase().indexOf(keyword) != -1) { document.write(" "); document.write(" [ + links[q].URL + " + links[q].Name + "] "); document.write(links[q].Desc + " "); document.write(" " + links[q].URL + " "); document.write(" "); continue; } } }