Changer la couleur des cellules
Bonjour !
J'ai un petit soucis sur ce morceau de code, je comprend pas très bien d'où ça peut provenir :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| function Couleur(id)
{
this.priorite1 = '#FE0000';
this.priorite2 = '#FFCC00';
this.priorite3 = '#00FF08';
this.id=id;
if (document.getElementById(this.id).style.bgcolor== this.priorite1 ){
document.getElementById(this.id).style.bgcolor= this.priorite2;
}
else if (document.getElementById(this.id).style.bgcolor== this.priorite2){
document.getElementById(this.id).style.bgcolor= this.priorite3;
}
else if (document.getElementById(this.id).style.bgcolor== this.priorite3){
document.getElementById(this.id).style.bgcolor= this.priorite1;
}
} |
et sur mes cellules j'ai :
Code:
1 2 3
| <td id="1-10" onclick="Couleur(this.id)" bgcolor="#00FF08">
10
</td> |
Sur click la couleur ne change pourtant pas : x
Merci d'avance !