bsr cher amis,
je voudrais savoir kment donner une couleur a une cellule en cliquant sur un checkbox.
merci
bsr cher amis,
je voudrais savoir kment donner une couleur a une cellule en cliquant sur un checkbox.
merci
salut !
avec biensur
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input type=checkbox onclick="document.getElementById('cellule').style.backgroundColor = this.checked?'#99CCFF':'C0C0C0'" />
@+
Code : Sélectionner tout - Visualiser dans une fenêtre à part <td id=cellule>...</td>
merci pour ton code c'est cool.
mais avez vous déja utiliser DYNTABLE qui est fait en javascript.
je ve réaliser un tableau contenant des chekbox a la première ligne et aussi a la première colonne.
et lorsque l'on clique sur un chebox de la ligne et de la colonne, la cellule d'intersection de ses 2 checkbox donne une couleur.
c'est vraiment compliqué pour moi.
voici un exemple: http://www.idea.int/publications/des...y/dyntable.cfm
SVP aider moi.
salut !
essaie ça
je l'ai écrit à la va-vite : tu ferais mieux de "fabriquer" une belle fonction
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 <html> <head> </head> <body> <table border=1 style="background-color:#C0C0C0"> <tr> <td id=c0_l0> </td> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c1_l'+i).style.backgroundColor = this.checked&&document.getElementById('l'+i).checked?'#99CCFF':'#C0C0C0'" id=c1 /> </td> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c2_l'+i).style.backgroundColor = this.checked&&document.getElementById('l'+i).checked?'#99CCFF':'#C0C0C0'" id=c2 /> </td> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c3_l'+i).style.backgroundColor = this.checked&&document.getElementById('l'+i).checked?'#99CCFF':'#C0C0C0'" id=c3 /> </td> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c4_l'+i).style.backgroundColor = this.checked&&document.getElementById('l'+i).checked?'#99CCFF':'#C0C0C0'" id=c4 /> </td> </tr> <tr> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c'+i+'_l1').style.backgroundColor = this.checked&&document.getElementById('c'+i).checked?'#99CCFF':'#C0C0C0'" id=l1 /> </td> <td id=c1_l1> </td> <td id=c2_l1> </td> <td id=c3_l1> </td> <td id=c4_l1> </td> </tr> <tr> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c'+i+'_l2').style.backgroundColor = this.checked&&document.getElementById('c'+i).checked?'#99CCFF':'#C0C0C0'" id=l2 /> </td> <td id=c1_l2> </td> <td id=c2_l2> </td> <td id=c3_l2> </td> <td id=c4_l2> </td> </tr> <tr> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c'+i+'_l3').style.backgroundColor = this.checked&&document.getElementById('c'+i).checked?'#99CCFF':'#C0C0C0'" id=l3 /> </td> <td id=c1_l3> </td> <td id=c2_l3> </td> <td id=c3_l3> </td> <td id=c4_l3> </td> </tr> <tr> <td> <input type=checkbox onclick="for (i=1; i<5; i++) document.getElementById('c'+i+'_l4').style.backgroundColor = this.checked&&document.getElementById('c'+i).checked?'#99CCFF':'#C0C0C0'" id=l4 /> </td> <td id=c1_l4> </td> <td id=c2_l4> </td> <td id=c3_l4> </td> <td id=c4_l4> </td> </tr> </table> </body> </html>
allez, @+
Merci scheriff pour ton aide précieuse.
le blème est que g sui un developpeur php et je connait qu'une petite partie de javascript.je vais essayer de coder quelque chose comme tu le dit.
Mais peut tu me donner une voix a suivre.
Bien de chose a toi.
Partager