Bonjour,
Encore grâce à ce site, j'ai pu avoir ce que je recherchais.
La boucle FOR ne remonte rien et je ne comprend pas pourquoi.
Merci
Encore grâce à ce site, j'ai pu avoir ce que je recherchais.
La boucle FOR ne remonte rien et je ne comprend pas pourquoi.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Base de Connaissance</title>
<script type = 'text/javascript'>
function store (data)
{
data[0]=new Stock("BIBLI 0","","02-2020","doc/Bpc.pdf" );
data[1]=new Stock("CONNEXION 1","","02-2020","doc/connexion.pdf" );
data[2]=new Stock("PERSONNAGE 2","","03-2020","doc/personnage.pdf" );
data[3]=new Stock("MATRICE 3","","03-2020","doc/NouvelleMatrice.pdf" );
data[4]=new Stock("REVISION 4","","03-2020","doc/RelectureRapide.pdf" );
data[5]=new Stock("REVISION 5","","03-2020","doc/RelectureRapide.pdf" );
data[6]=new Stock("REVISION 6","","03-2020","doc/RelectureRapide.pdf" );
data[7]=new Stock("REVISION 7","","03-2020","doc/RelectureRapide.pdf" );
data[8]=new Stock("REVISION 8","","03-2020","doc/RelectureRapide.pdf" );
data[9]=new Stock("REVISION 9","","03-2020","doc/RelectureRapide.pdf" );
data[10]=new Stock("BIBLI 10","","02-2020","doc/Bpc.pdf" );
data[11]=new Stock("CONNEXION 11","","02-2020","doc/connexion.pdf" );
data[12]=new Stock("PERSONNAGE 12 ","","03-2020","doc/personnage.pdf" );
data[13]=new Stock("MATRICE 13","","03-2020","doc/NouvelleMatrice.pdf" );
data[14]=new Stock("REVISION 14","","03-2020","doc/RelectureRapide.pdf" );
data[15]=new Stock("REVISION 15","","03-2020","doc/RelectureRapide.pdf" );
data[16]=new Stock("REVISION 16","","03-2020","doc/RelectureRapide.pdf" );
data[17]=new Stock("REVISION 17","","03-2020","doc/RelectureRapide.pdf" );
data[18]=new Stock("REVISION 18","","03-2020","doc/RelectureRapide.pdf" );
data[19]=new Stock("REVISION 19","","03-2020","doc/RelectureRapide.pdf" );
data[20]=new Stock("BIBLI 20","","02-2020","doc/Bpc.pdf" );
data[21]=new Stock("CONNEXION 21","","02-2020","doc/connexion.pdf" );
data[22]=new Stock("PERSONNAGE 22","","03-2020","doc/personnage.pdf" );
data[23]=new Stock("MATRICE 23","","03-2020","doc/NouvelleMatrice.pdf" );
data[24]=new Stock("REVISION 24","","03-2020","doc/RelectureRapide.pdf" );
data[25]=new Stock("REVISION 25","","03-2020","doc/RelectureRapide.pdf" );
data[26]=new Stock("REVISION 26","","03-2020","doc/RelectureRapide.pdf" );
data[27]=new Stock("REVISION 27","","03-2020","doc/RelectureRapide.pdf" );
data[28]=new Stock("REVISION 28","","03-2020","doc/RelectureRapide.pdf" );
data[29]=new Stock("REVISION 29","","03-2020","doc/RelectureRapide.pdf" );
function afficher()
{
w.document.writeln( '<table><tr><td><h3><a target="_blank" rel="noopener" href=' + this.url + '>' + this.titre + '</a></h3></td></tr></table>' );
}
function Stock( titre_in,keyword_in,url_in )
{
this.titre = titre_in;
this.keyword = keyword_in;
this.url = url_in;
this.afficher = afficher;
}
/* Cette fonction récrit entièrement la page web pour y afficher les résultats */
function rechercher( chaine )
{
var trouved = 0;
chaine = chaine.toUpperCase();
var data = new Array();
store( data );
w=open('index.html','','');
/*w.document.writeln( "<html><head><title>Résultats de la recherche</title><link href='css.css' rel='stylesheet' type='text/css'></head>" );*/
/*w.document.writeln( "<body><div id='Corps'><h3>Résultats de la recherche "+chaine+"</h3></div>" );*/
w.document.writeln("<center><p style='color: blue; font-weight: bold;'><h3> Résultats de la recherche "+chaine+"</h3></p></center>");
for( var i=0; i<data.length ; i++ )
{
if(( data[i].titre.toUpperCase().indexOf( chaine ) != -1 ) || ( data[i].keyword.toUpperCase().indexOf( chaine ) != -1 )
|| ( data[i].url.toUpperCase().indexOf( chaine ) != -1 ))
{
if (trouved<5) {
w.document.writeln( '<table><tr><td><h3><a target="_blank" rel="noopener" href=' + data[i].url + '>' + data[i].titre + '</a></h3></td></tr></table>' );
} else {
w.document.writeln( '<h3>TROP DE RÉPONSES ! AJOUTER UN MOT CLE</h3>' );
}
trouved ++;
}
}
if( !trouved )
{
w.document.writeln( "<p style='color: red; font-weight: bold;'>Aucune réponse n'a été trouvée pour ce mot clé dans Base_Doc.</p>");
}
/*w.document.writeln( "<p style='color: blue; font-weight: bold;'>"+trouved+" réponse(s) trouvée(s) pour le mot-clé "+chaine);*/
w.document.writeln( "</p><hr><form><input type='button' value='Nouvelle recherche ?' OnClick='window.location=\"index.html\"'></form></div>" );
w.document.writeln( "</body></html>" );
w.document.close();
}
</script>
</head>
<body>
<div id="Header0">
</div>
<!--- HEADER --->
<div id="Header1">
<div class="HeaderRecherche">
<center>
<form name="rech" OnSubmit="rechercher( document.rech.champ.value );">
<input type="text" name="champ" size="70"><BR>
<input type="submit" name="valide" value="Rechercher">
</form>
<noscript><p>
Votre navigateur ne reconnait pas le JavaScript, le script de recherche ne pourra pas marcher.
</p></noscript>
</center>
</div>
</div>
<!--- END HEADER --->
<!--- CENTRAL --->
<div id="Corps">
<div id="CorpsLeft">
</div>
<div id="CorpsCenter">
</div>
<div id="CorpsRight">
</div>
</div>
<!--- END CENTRAL --->
<!--- FOOTER --->
<div id="Footer">
<!--- Tableau 6 Colonnes -- 10 Lignes dont une en titre-->
<table>
<!--- TITRES--->
<thead>
<tr>
<th><span style='color:black; font-weight:bold' >WEB</span> </th>
<th><span style='color:black; font-weight:bold' >MEMO</span> </th>
<th><span style='color:black; font-weight:bold' >ANNUAIRES</span> </th>
<th><span style='color:black; font-weight:bold' >DICTIONNAIRE</span> </th>
<th><span style='color:black; font-weight:bold' >MODELES</span> </th>
<th><span style='color:black; font-weight:bold' >SITES</span> </th>
</tr>
</thead>
<!--- Ligne1 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne3--->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne4--->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne5--->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne6 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne7 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne8 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne9 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!--- Ligne10 --->
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<!--- END FOOTER --->
</body>
</html>
Merci