[thelist] Is it possible to change the table cell bgcolor by JavaScript?

martin.p.burns at uk.pwcglobal.com martin.p.burns at uk.pwcglobal.com
Wed Jan 24 08:40:31 CST 2001


Memo from Martin P Burns of PricewaterhouseCoopers

-------------------- Start of message text --------------------

I wonder if an onMouseOver event would be what you're after, rather
than an onClick...

Doesn't work in ie4 anyway.

Cheers
Martin





Please respond to thelist at lists.evolt.org
To:   thelist at lists.evolt.org
cc:


Subject:  RE: [thelist] Is it possible to change the table cell bgcolor by
      JavaScript?



ppk,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Peter-Paul Koch
:
: > The problem is to address the cell object
: > in JavaScript. Is it possible anyway?
:
: The simplest solution by far (but it requires
: lots of code) is:
:
: <TD onClick="this.bgColor = '#cc0000'">stuff</TD>
:
: and onClick the background colour changes.
: Works in IE4+ and NN6.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

the trouble with this example is that you'll end up with all the td's with
their background color changed.  that's fine if that's what you're looking
to do.  however, if you want to turn off the previously selected td you're
going to have to store a reference to that object so you know which one to
switch back when a new one is clicked.  at that point you're just better off
using a function.



--------------------- End of message text --------------------

The principal place of business of PricewaterhouseCoopers and its associate
partnerships is 1 Embankment Place, London WC2N 6NN where lists of the
partners' names are available for inspection. All partners in the associate
partnerships are authorised to conduct business as agents of, and all
contracts for services to clients are with, PricewaterhouseCoopers. The UK
firm of PricewaterhouseCoopers is authorised by the Institute of Chartered
Accountants in England and Wales to carry on investment business.
PricewaterhouseCoopers is a member of the world-wide
PricewaterhouseCoopers organisation.
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited.   If you received this in error, please
contact the sender and delete the material from any computer.






More information about the thelist mailing list