Bonjour à tous

Je suis en train de créer une messagerie en intranet pour ma boite.

J4ai trouvé un petit script sur l'editeur javascript sur lequel on a 3 actions qui permettent de selectionner tout, de tout déselectionner ou d'inverser une selction deja faite.

J'ai bien placé le script comme il se devait mais pourtant rien ne fonctionne or je n'ai pas de messages d'erreurs.

Je ne sais pas pourquoi il ne fonctionne pas.

Voici le code concerné:
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<script type="text/javascript">
<!--
// ==========================
// Script réalisé par Eric Marcus - Aout 2006
// ==========================
 
// conteneur = id du bloc (<div>, <p> ...) contenant les checkbox
// a_faire = '0' pour tout décocher
// a_faire = '1' pour tout cocher
// a_faire = '2' pour inverser la sélection
 
function GereChkbox(conteneur, a_faire) {
var blnEtat=null;
var Chckbox = document.getElementById(conteneur).firstChild;
	while (Chckbox!=null) {
		if (Chckbox.nodeName=="INPUT")
			if (Chckbox.getAttribute("type")=="checkbox") {
				blnEtat = (a_faire=='0') ? false : (a_faire=='1') ? true : (document.getElementById(Chckbox.getAttribute("id")).checked) ? false : true;
				document.getElementById(Chckbox.getAttribute("id")).checked=blnEtat;
			}
		Chckbox = Chckbox.nextSibling;
	}
}
//-->
</script>
<form><div id="div_chck">
<table width="100%" border="0" id='box-table-a'>
  <tr>
    <th scope="col" width="15%"><strong>Exp&eacute;diteur</strong></th>
    <th scope="col" width="60%"><strong>Message</strong></th>
    <th scope="col" width="10%"><strong>Date</strong></th>
    <th scope="col" width="15%"><strong>Actions</strong></th>
  </tr><?php $sql="SELECT * FROM `messages` WHERE `id_destinataire`='".$_SESSION['login']."' AND `trash`='0' ORDER BY id DESC LIMIT ".$premiereEntree.", ".$messagesParPage."" ;
$result=mysql_query($sql) or die(__LINE__.mysql_error().$sql);
$i=0; 
while($data=mysql_fetch_assoc($result)) {												 ?>
<tr>
<td align="left"><?php $req="SELECT * FROM `gestionnaire` WHERE `login`='".$data['id_expediteur']."'";
$result2=mysql_query($req) or die(__LINE__.mysql_error().$req);
$expediteur=mysql_fetch_assoc($result2);  ?><img src="<?php if (!empty($expediteur['urlavatar'])) {echo $expediteur['urlavatar']; } else {echo "images/noAvatar.gif" ;} ; ?>" width="50px" height="50px" /><br /><?php echo $expediteur['nom'].' '.$expediteur['prenom'] ; ?></td>
<td><?php if($data['lu']=='0') { echo '<p align="left"><img src="images/Gnome-Mail-Unread-32.png" width="24px" height="24px" /><strong>  '.$data['titre'].'</strong></p>';
$nbChar = 150; // Nb. de caractères sans '...'
 
if(strlen($data['message']) >= $nbChar)
    $message = substr($data['message'], 0, $nbChar).' [...]';
 
echo '<p align="left"><i>'.$message.'</i></p>';
}
else { echo '<p align="left"><img src="images/Gnome-Emblem-Mail-32.png" width="24px" height="24px" /><strong>  '.$data['titre'].'</strong></p>';
$nbChar = 150; // Nb. de caractères sans '...'
 
if(strlen($data['message']) >= $nbChar)
    $message = substr($data['message'], 0, $nbChar).' [...]';
 
echo '<p align="left"><i>'.$message.'</i></p>';} ;
?></td>
<td><?php echo  date('d-m-Y H:i',strtotime($data["date"])) ; ?></td>
<td><a href="index.php?p=liremessage&amp;id=<?php echo $data['id'] ; ?>"><img src="images/email_open.png" alt="Lire le message" width="24px" height="24px" border="0"  /></a> <img src="images/Gnome-Mail-Forward-32.png" alt="Transf&eacute;rer le message" width="24px" height="24px" border="0"  /> <a href="deletemessage.page?id=<?php echo $data['id'] ; ?>" onclick="return confirm('Voulez vous vraiment supprimer ce message?')"><img src="images/mail-trash.png" alt="Supprimer ce message" width="24px" height="24px" border="0"  /></a> <input type="checkbox" name="action[<?php echo ++$i; ?>]" id="checkbox<?php echo $i; ?>"  /></td>
</tr>
<?php } ; ?>
</table>
<table width="99%" border="0">
 
  <tr>
    <td width="53" style="vertical-align:bottom">Actions: </td><td width="370"><input type="button" value="Tout cocher" onClick="GereChkbox('div_chck','1');">&nbsp;&nbsp;&nbsp;
  <input type="button" value="Tout d&eacute;cocher" onClick="GereChkbox('div_chck','0');">&nbsp;&nbsp;&nbsp;
  <input type="button" value="Inverser la s&eacute;lection" onClick="GereChkbox('div_chck','2');"></td>
    </tr>
  <tr>
    <td style="vertical-align:bottom" >Quota: </td>
    <td style="vertical-align:bottom"><?php $var=($total/500)*100 ; ?>
      <img src="pc3.php?pc=<?php print $var ?>" alt="" /></td>
  </tr>
</table>
</div>
</form>
les cases a cochées sont dans les cellules d'un tableau.

voici le rendu visuel si ça peut aider a mieux situer les éléments

image


par avance merci pour votre aide