Re: plier/déplier tableau
Il se trouve que Francis Spiesser a formulé :
> Tu peux aussi voir au niveau des tbody pour afficher/masquer des blocs de
> ligne. Pour les colonnes ça se complique parce que certains styles ne
> fonctionnent pas dans les colgroup.
> A mon avis, ce serait plus facile d'y arriver avec une matrice de div
> habilement nommées
> [ id=C1-R1 ][ id=C2-R1 ]...[ id=Cn-R1 ]
> [ id=C1-R2 ][ id=C2-R2 ]...[ id=Cn-R2 ]
> ...
> [ id=C1-Rn ][ id=C2-Rn ]...[ id=Cn-Rn ]
Sinon le code ci-dessous fonctionne dans IE mais pas dans FF (pour la
colonne)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Document sans nom</title>
</head>
<body><table width="200" border="1">
<colgroup span="1"><col id="col1" /></colgroup>
<colgroup span="1"><col id="col2" /></colgroup>
<colgroup span="1"><col id="col3" /></colgroup>
<tbody id="lig1">
<tr>
<th> </th>
<th>A</th>
<th>B</th>
</tr>
</tbody>
<tbody id="lig2">
<tr>
<th>1</th>
<td>A1</td>
<td>B1</td>
</tr>
</tbody>
<tbody id="lig3">
<tr>
<th>2</th>
<td>A2</td>
<td>B2</td>
</tr>
</tbody>
</table>
<a href="#"
onclick="document.getElementById('col2').style.dis play='';return
false">Afficher la colonne A</a> / <a href="#"
onclick="document.getElementById('col2').style.dis play='none';return
false">Masquer la colonne A</a><br />
<a href="#"
onclick="document.getElementById('lig2').style.dis play='';return
false">Afficher la ligne 1</a> / <a href="#"
onclick="document.getElementById('lig2').style.dis play='none';return
false">Masquer la ligne 1</a>
</body>
</html>
--
______
Francis (enlever .NIPUBNISOUMIS)
"La dinde est tolérante, mais elle déteste les farceurs"
|