I\'m trying to study for my exam and I thought I was doing this right... I want to change the color of the table (font or background) depending on which cell you click I thought
Setting backgroundColor
is correct, but what's going on with font.color
? Where did that come from?
Just use style.color
.
Also, fix the typo "getElementById" in the second one.
Change getLementbyId
and getElementbyId
to getElementById
and change font.color
to color
.
function changeFont(color){
document.getElementById("miTabla").style.color = color;
}
function changeBack(color){
document.getElementById("miTabla").style.backgroundColor = color;
}
changeFont
might also be more appropriately named changeForeground
.