M
ms
Hi, I've been trying to find a way to change a cell's colour when clicking it.
What I've found so far is to change the background colour by using:
function whenClick(navElm) {
var state1 = '#0000FF';
if(navElm.style.backgroundcolor != state1){
navElm.style.backgroundcolor = state1;
}
}
My problem is, first it does not work when I used <td bgcolor="#00FFFF" id ="s2"
onclick ="whenClick(this)"> </td>; second, what I want is to change the
border colour. Could anyone please help me on that?
Thanks a lot!
What I've found so far is to change the background colour by using:
function whenClick(navElm) {
var state1 = '#0000FF';
if(navElm.style.backgroundcolor != state1){
navElm.style.backgroundcolor = state1;
}
}
My problem is, first it does not work when I used <td bgcolor="#00FFFF" id ="s2"
onclick ="whenClick(this)"> </td>; second, what I want is to change the
border colour. Could anyone please help me on that?
Thanks a lot!