Bonjour à tous,

Je fais mes premiers pas en javascript, j'ai trouvé un scrîpt qui me permet de rechercher un mot dans une page web.
Seulement, j'aimerais que ce script s'adapte à une recherche dans une colonne. Je m'explique: j'ai un tableau avec trois champs ref, designation,famille. Ce tableau comporte plus de 1000 enregistrements. J'ai donc "fais" une zone de recherche, mais je souhaite que cette recherche ne s'effectue pas sur toutes les colonnes mais simplement sur la colonne designation. Je pense que l'astuce se situe au niveau du document.body mais j'ai beau cherché de la documentation, je ne trouve pas.

Voici le code du script de recherche dans la page :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
<SCRIPT LANGUAGE="JavaScript">
var IE4 = (document.all);
var win = window;    // window to search.
var n   = 0;
function findInPage(str) {
 var txt, i, found;
 if (str == "")
 return false;
 
 if (IE4) {
 txt = win.document.body.createTextRange();
 
 for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
 txt.moveStart("character", 1);
 txt.moveEnd("textedit");
 }
 // If found, mark it and scroll it into view.
 if (found) {
 txt.moveStart("character", -1);
 txt.findText(str);
 txt.select();
 txt.scrollIntoView();
  n++;
  }
 else {
 if (n > 0) {
 n = 0;
 findInPage(str);
 }
 else
 alert("Not found.");
 }
 }
 return false;
 }
</script>
 
//En tete de mon tableau
 
<table id='decotableappel' border='1'>
   <tr>
     <td height='20' width='100'><a href='saisi2triarticle.php'>Reference</td>
     <td height='20' width='100'>
 
	<form name='search' onSubmit='return findInPage(this.string.value);'>
	<a href='saisi2tridesignation.php'>D&eacute;signation</a>
	<input name="string" type="text" size="15" onChange="n = 0;">
	<input type='submit' class='buttonsearch' value='OK'></form>
 
     </td>	
     <td height='20' width='100'><a href='saisi2trifamille.php'>Famille</a></td>
  </tr>
D'avance, un grand merci d'avoir pris le temps de me lire