»
AnglaisFranaisVietnamien

Imprimer - Automatique des lignes de couleur - JavaScriptBank.com

Version complte: jsB@nk » CSS » Automatique des lignes de couleur
URL: http://www.javascriptbank.com/automatic-coloured-rows.html

Automatique des lignes de couleur © JavaScriptBank.comVous en avez assez de curieux et même d'ajouter des cours pour vos tables de distinguer les lignes? Cet JavaScript le fera automatiquement pour vous. Vous pouvez même l'utiliser avec des listes!

Version complte: jsB@nk » CSS » Automatique des lignes de couleur
URL: http://www.javascriptbank.com/automatic-coloured-rows.html



CSS
<style type="text/css">.rowTint {  background-color: #ddd;}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="javascript">// Created by: Anton Peck :: http://antonpeck.com//* To use with lists, just change  document.getElementsByTagName('tr');to  document.getElementsByTagName('li');*/window.onload = colorRows;function colorRows() {  var myTR = document.getElementsByTagName('tr');  for (var i=0;i<myTR.length;i++) {    if (i%2) {      myTR[i].className = 'rowTint';    }  }}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<table align="center">  <thead>    <tr>    <th>Browsers</th>    <th>Hits</th>    <th>Percent</th>    </tr>  </thead>  <tbody>    <tr>      <td>Mozilla Firefox</td>      <td>15772</td>      <td>73%</td>    </tr>    <tr>      <td>Internet Explorer 6</td>      <td>4581</td>      <td>21.2%</td>    </tr>    <tr>      <td>Mozilla</td>      <td>442</td>      <td>2%</td>    </tr>    <tr>      <td>Opera</td>      <td>122</td>      <td>0.5%</td>    </tr>    <tr>      <td>Safari</td>      <td>100</td>      <td>0.4%</td>    </tr>    <tr>      <td>Netscape</td>      <td>99</td>      <td>0.4%</td>    </tr>  </tbody></table><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->