asp.net - How to change cell background color on click cell in table? -
i need change color of cells on сlick (only 2 colors: black , white), , analyze colors of cells form array values: 1 - black, 0 - white?
try code toggle color
onclick="this.style.backgroundcolor=='black' ? this.style.backgroundcolor='white' : this.style.backgroundcolor='black';" and colors using function
var tds = document.getelementsbytagname("td"); for(var i=0; i<tds.length; i++) { alert(tds[i].style.backgroundcolor); } }
Comments
Post a Comment