change colors of table with javascript

后端 未结 2 664
北海茫月
北海茫月 2021-01-29 08:29

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

2条回答
  •  时光取名叫无心
    2021-01-29 09:20

    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.

提交回复
热议问题