Salut j'en cré un nouveau pour que tout soit compréhensible:
j'ai trouvé un code que je comprend:
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
<html><head>
<title>checkbox maître</title>
<script>
//checkbox ou une liste de checkbox.
function selectall(cas,choix){
  //test si on a plusieur ligne
  if(choix.length>0){
    if (cas.checked){
      for (var i=0; i<choix.length;i++){
        choix[i].checked=true
      }
    }
    else{
      for (var i=0; i<choix.length;i++){
        choix[i].checked=false
      }
    }
  }
  else{
    if (cas.checked){
      choix.checked=true
    }
    else{
      choix.checked=false
    }
  }
}</script>
</head>
 
<body>
<form name="monform">
<input type="checkbox" name="all" onclick="selectall(document.monform.all,document.monform.choix)">
puis un liste de checkbox
<input type="checkbox" name="choix" value="1">
<input type="checkbox" name="choix" value="2">
<input type="checkbox" name="choix" value="3"></form>
</body></html>
Voici enfin une explication sur ce code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
Petit explication sur l'utilisation:
dans un formulaire on place une checkbox "maitre" en lui associant la fonction selectall sur l'action onclick:
<input type="checkbox" name="all" onclick="selectall(document.monform.all,document.monform.choix)">
puis un liste de checkbox
<input type="checkbox" name="choix" value="1">
<input type="checkbox" name="choix" value="2">
<input type="checkbox" name="choix" value="3">
et voici mon code une fois modifier:
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
<? include("connect.inc") ?>
<html>
<link rel="stylesheet" href="sitebn.css" type="text/css">
<head>
<META HTTP-EQUIV="Refresh" CONTENT="20";>
<script>:D 
//checkbox ou une liste de checkbox.
function selectall(cas,choix){
  //test si on a plusieur ligne
  if(choix.length>0){
    if (cas.checked){
      for (var i=0; i<choix.length;i++){
        choix[i].checked=true
      }
    }
    else{
      for (var i=0; i<choix.length;i++){
        choix[i].checked=false
      }
    }
  }
  else{
    if (cas.checked){
      choix.checked=true
    }
    else{
      choix.checked=false
    }
  }
}</script>:D 
<body>
<form name="liste.php" action="unepers.php" method="post">
<center><font color='red'><h1><i>Liste des réservations et gestion de la base de donnée</i></h1></center>
 
<a href="effacertoutroulage.php"><br><font color='yellow'>Cliquez ici pour effacer toutes les réservations de votre liste</a></font></p>
 
<table class="frm" align="center">
<tr><th bgcolor='#99CCFF' width="1%">Numéro</th><th bgcolor='#99CCFF' width="3%">Grade</th><th bgcolor='#99CCFF' width="15%">Nom</th><th bgcolor='#99CCFF' width="15%">Prénom</th><th bgcolor='#99CCFF' width="5%">Téléphone</th><th bgcolor='#99CCFF' width="20%">Motif</th><th bgcolor='#99CCFF' width="2%">Jour</th><th bgcolor='#99CCFF' width="2%">Mois</th><th bgcolor='#99CCFF' width="4%">Année</th><th bgcolor='#99CCFF' width="3%">Heure début</th><th bgcolor='#99CCFF' width="2%">Minutes début</th><th bgcolor='#99CCFF' width="3%">Heure fin</th><th bgcolor='#99CCFF' width="3%">Minutes fin</th><th bgcolor='#99CCFF' width="6%">Effacer</th><th bgcolor='#99CCFF' width="10%">Tout sélectionner:D <form name="monform">
<input type="checkbox" name="all" onclick="selectall(document.monform.all,document.monform.choix)">:D 
 
</th></tr>
 
<?
$resultat = mysql_query("select `id` , `grade` , `nom` , `prenom` , `telephone` , `motif` , `From_day` , `From_month` , `From_year` , `heuredebut` , `minutesdebut` , `heurefin` , `minutesfin` from roulage");
while($ligne= mysql_fetch_object($resultat))
 
{
    echo "<tr onclick=\ onmouseover=\"this.className='over'\" onmouseout=\"this.className='out'\" class=\"out\">
    <td><font color='yellow'><center>$ligne->id</center></font></td>
    <td><font color='yellow'><center>$ligne->grade</center></font></td>
    <td><font color='yellow'><center>$ligne->nom</center></font></td>
    <td><font color='yellow'><center>$ligne->prenom</center></font></td>
    <td><font color='yellow'><center>$ligne->telephone</center></font></td>
    <td><font color='yellow'><center>$ligne->motif</center></font></td>
    <td><font color='yellow'>$ligne->From_day</font></td>
    <td><font color='yellow'>$ligne->From_month</font></td>
    <td><font color='yellow'>$ligne->From_year</font></td>
    <td><font color='yellow'><right>$ligne->heuredebut</right></font></td>
    <td><font color='yellow'><left>$ligne->minutesdebut</left></font></td>
    <td><font color='yellow'>$ligne->heurefin</font></td>
    <td><font color='yellow'>$ligne->minutesfin</font></td>
    :D <td><CENTER><INPUT TYPE='checkbox' value='checkbox' name='choix'/></CENTER></td>
    <td><CENTER><INPUT TYPE='checkbox' value='$ligne->id' name='choix'/></CENTER></td>:D 
    </tr>";
}
 
?>
 
</table>
</head>
</body>
</p><input type="submit" NAME="submit" value="Supprimer" action="unepers.php">
</html>
j'ai mis des smiley pour vous montré ou j'ai mis le code.
je pense que sa ne marche pas car mes checkbox sont dans du php.
j'aimerai qu'on m'aide a trouvé une solution dans mon code j'y suis presque merci de m'aider!