bonjour,
j'ai un tableau généré (avec struts display:table) et je voudrais changer du texte de la dernière colonne du THEAD.
attention, je ne peux pas mettre d'ID pour la cellule concernée. je peux mettre un id pour le tableau en reevanche
Comment remplacer le texte de la dernière cellule (Imprimer) par une checkbox ?
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 <table height="250" width="100%" cellspacing="1" id="tableauCourriers"> <thead> <tr> <th width="350" class="sorted order1 sortable" align="center"> <a href="/suren2/dco/courriersJustif.do?reqCode=display">Nom des courriers</a></th> <th width="125" class="sortable" align="center"> <a href="/suren2/dco/courriersJustif.do?reqCode=display">date</a></th> <th width="50" class="sortable" align="center"> <a href="/suren2/dco/courriersJustif.do?reqCode=display">PV</a></th> <th width="350" class="sortable" align="center"> <a href="/suren2/dco/courriersJustif.do?reqCode=display">Gestionnaire</a></th> <th width="50" align="center">Imprimer</th> </tr> </thead> <tbody> <!-- mon tableau généré --> </tbody>
J'ai tenté :
je ne connais pas bien javascript : ma difficulté principale est de situer la cellule pour ensuite y écrire. comment faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 function rewriteTableHead() { var row = document.getElementById("tableauCourriers").getElementsByTagName("THEAD")[0].insertRow(0); cell = row.insertCell(4); cell.innerHTML='<input type="checkbox" onclick="checkall();" name="'+choixTous+'" value="0">'; } window.onload = rewriteTableHead;
Partager