Bonjour,
En fait j'ai un tableau avec plusieurs cases, et j'aimerai que dès que l'on clique sur une case, les autre cases de la lignes changent de background (pour faire un effet graphique de sélection).
Voici le code de ma JSP :
Et le javascript :
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 <table class="tableau_affichage"> <tr> <th width="8"></th> <th>N°</th> <th>Livraison</th> <th width="210">Emetteur</th> <th>Version</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> </tr> <tbody> <logic:notEmpty name="tableauDemandesIntegration" property="livListCollection"> <logic:iterate id="demandesIntegration" name="tableauDemandesIntegration" property="livListCollection" > <logic:present name="demandesIntegration" > <tr> <td><html:img alt="Voir" src="/LivApp/Images/mutmut.jpg" width="30" onclick="javascript:selected();"/></td> <td id="num"><bean:write name="demandesIntegration" property="numero" /></td> <td id="dateLiv"><bean:write name="demandesIntegration" property="dateLivraison" format="dd-MM-yyyy" /></td> <td id="nomEm"><bean:write name="demandesIntegration" property="nomEmetteur" /></td> <td id="versEnv"><bean:write name="demandesIntegration" property="versionEnvironnement" /></td> <td id="carre1"> </td> <td id="carre2"> </td> <td id="carre3"> </td> <td id="carre4"> </td> </tr> </logic:present> </logic:iterate> </logic:notEmpty> </tbody> </table>
Lorsque je clique sur l'img j'ai une erreur dans mon Javascript et je ne vois pas comment la corriger.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <script type="JavaScript"> function selected(){ document.getElementById('num').bgcolor = '#FFC891'; document.getElementById('dateLiv').bgcolor = '#FFC891'; document.getElementById('nomEm').bgcolor = '#FFC891'; document.getElementById('versEnv').bgcolor = '#FFC891'; } </script>
Merci de votre aide![]()
Partager