On Dec 2, 6:39 am, AwayBBL <
away...@gmail.com> wrote:
> Linda, You could probably do that with an onclick. When someone
> clicks, change the bgcolor of the cell.
>
> pseudo code...
>
> function chColor(tdName) {
> document.getElementById(tdName).style.backgroundColor ="white";
If you pass a reference to the td from the calling handler, your
function becomes:
function chColor(el) {
el.style.backgroundColor = 'white';
}
which is much more efficient than hard-coding the ID value. Since a
td element can have both a name and an ID, I wouldn't use a variable
that expects to get an ID "tdName".
>
> }
>
> <table><tr>
> <td id="td_1" onclick="chColor('td_1')" >Stuff in the cell</td>
And the handler:
<td onclick="chColor(this);" ...
Another method is to add or remove a class name, that way you can
control display properties independently of your code.
--
Rob