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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -