On Dec 2, 6:39 am, AwayBBL <[EMAIL PROTECTED]> 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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to