alterner les couleurs d'un tableau

nancyl768
Invité n'ayant pas de compte PHPfrance

21 juin 2006, 16:26

Salut

Voici mon code :
 
 <table border="0">
    <tr> 
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Numéro d'affiliation</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Photo</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Nom</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Prénom</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Nationalité</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Date de naissance</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Numéro de maillot</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Place sur le terrain</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Buts marqués</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Matches joués</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Carte rouge</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Carte jaune</font></th>
      <th bgcolor="#6699CC"><font color ="#C6D1E3">Numéro de matricule de l'équipe</font></th>
    </tr>
    <?php do { ?>
    <tr> 
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NumAffiliation']; ?></font></th>
      <th bgcolor="#CCCCCC" width="144" height="192"><img src="<?php echo $dir.$row_joueurs['PhotoJoueurs']; ?>"></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NomJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['PrenomJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NationaliteJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['DateNaissJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NumMaillotJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['PlaceTerrainJoueurs']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NbreButsMarques']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NbreMatchesJoues']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NbreCarteRouge']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NbreCarteJaune']; ?></font></th>
      <th bgcolor="#CCCCCC"><font color ="#003399"><?php echo $row_joueurs['NumMatricule']; ?></font></th>
    </tr>
    <?php } while ($row_joueurs = mysql_fetch_assoc($joueurs)); ?>
  </table>

Voilà mon tableau qui affiche les données d'une table de ma base de donnée. J'aimerai alterner les couleurs soit des lignes ou des cases. Je n'ai pas su trouver la bonne solution, je suis bloquée. :oops:

Pouvez vous m'aider :?:

Merci :D

Nancy :wink:

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 13231 Messages

21 juin 2006, 16:30

une petite recherche sur le forum sur "alternance couleur" m'a donné
http://www.phpfrance.com/forums/viewtop ... ce+couleur
Connaître son ignorance est la meilleure part de la connaissance
Pour un code lisible : n'hésitez pas à sauter des lignes et indenter

twitter - site perso - Github - Zend Certified Engineer