mouseover, mouseout and onclick in a <TD>

T

Tony Farrell

Hi everyone -

I am trying to accomplish a task that i thought would be easy -
and at this point - i'm starting to wonder...

I have a table setup, one column, ten rows

All the cells start off with a white background,
as the mouse passes over the cell, the background color
changes to a nice light blue. I have that working ok -

but the trick comes in as - when a user clicks in the
cell - i would like to change the background color to silver,
and when the user moves the mouse off of the cell - the background
will stay silver, until the user clicks another of the cells,
then that cell switches to silver, and the rest of the cells turn
to white...




does anyone have code to complete this task??

thanks
tony
 
M

Michael Winter

I am trying to accomplish a task that i thought would be easy -
and at this point - i'm starting to wonder...

I have a table setup, one column, ten rows

This sounds like element abuse: tables are supposed to contain tabular
data.
All the cells start off with a white background,
as the mouse passes over the cell, the background color
changes to a nice light blue. I have that working ok -

but the trick comes in as - when a user clicks in the
cell - i would like to change the background color to silver,
and when the user moves the mouse off of the cell - the background
will stay silver, until the user clicks another of the cells,
then that cell switches to silver, and the rest of the cells turn
to white...

Your specification lacks a little detail, so take a look and point out if
something needs changing that you can't fix yourself.

The demo page is here:

http://www.mlwinter.pwp.blueyonder.co.uk/clj/farrell/table.html


The two script files used are:

http://www.mlwinter.pwp.blueyonder.co.uk/clj/farrell/core.js
http://www.mlwinter.pwp.blueyonder.co.uk/clj/farrell/cells.js

Be careful to note the function call in a script block at the end of the
HTML document. That is important, and must be placed below the table.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top