i Have the following working
function changeCellcolor(cellID)
{
var cel=document.getElementById(cellID);
//if (cel.style.backgroundColor='#DDDDDD'){ return}
if (cel.style.backgroundColor=='')
{
//cel.style.backgroundColor='#DDDDDD';
cel.style.backgroundColor='green';
}
else
{
cel.style.backgroundColor='';
}
}
However I am trying to skip the function when the cell background is a different color
I tried this...
function changeCellcolor(cellID) {
//alert (cellID);
var cel=document.getElementById(cellID);
if (cel.style.backgroundColor='yellow') {
} else if (cel.style.backgroundColor=='') {
cel.style.backgroundColor='green';
} else {
cel.style.backgroundColor='';
}
}
The problem is this always runs what is in the first If statement. It turns the cell background to yellow
Aucun commentaire:
Enregistrer un commentaire