Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Changing background colour in a table cell from a function

Reply
Thread Tools

Changing background colour in a table cell from a function

 
 
NeoPhreak
Guest
Posts: n/a
 
      08-04-2003
I am creating a menu for my site and I would like it so that when the
onMouseOut even is triggered it will cause the cell of the table to fade out
back to the normal color with a delay.

Can anyone help me to get started on how i would accomplish this?



 
Reply With Quote
 
 
 
 
Gill Bates
Guest
Posts: n/a
 
      08-04-2003
you have to cycle through some colors (style attribute background-color)
with JavaScript and use setTimeOut


"NeoPhreak" <(E-Mail Removed)> wrote in message
newsmyXa.1539$(E-Mail Removed).. .
> I am creating a menu for my site and I would like it so that when the
> onMouseOut even is triggered it will cause the cell of the table to fade

out
> back to the normal color with a delay.
>
> Can anyone help me to get started on how i would accomplish this?
>
>
>



 
Reply With Quote
 
 
 
 
NeoPhreak
Guest
Posts: n/a
 
      08-05-2003
Any chance someone could please help me out by starting me off... I'd really
appreciate it!

thnx
>.< NeoPhreak


"Gill Bates" <(E-Mail Removed)> wrote in message
news:bgmivi$a1a$(E-Mail Removed)...
> you have to cycle through some colors (style attribute background-color)
> with JavaScript and use setTimeOut
>
>
> "NeoPhreak" <(E-Mail Removed)> wrote in message
> newsmyXa.1539$(E-Mail Removed).. .
> > I am creating a menu for my site and I would like it so that when the
> > onMouseOut even is triggered it will cause the cell of the table to fade

> out
> > back to the normal color with a delay.
> >
> > Can anyone help me to get started on how i would accomplish this?
> >
> >
> >

>
>



 
Reply With Quote
 
NeoPhreak
Guest
Posts: n/a
 
      08-05-2003
Thanks!! Great Help!

>.<NeoPhreak


"Richard Hockey" <(E-Mail Removed)> wrote in message
news:3f2f6909$0$11378$(E-Mail Removed) ...
> <script type="text/javascript">
> function cellbg(cellid,cellcolour)
> {
> // accept single cell id and colour, or comma seperated list of cell ids
> and cell colours
>
> // check to see if number of cells and number of colours match, if not

exit
> the function
> var CellList=cellid.split(',');
> var ColList=cellcolour.split(',');
> if(CellList.length!=ColList.length || CellList.length==0 ||
> ColList.length==0) return false;
>
> // actually change the cell colour
> for(n=0;n<CellList.length;n++)
> {
> document.getElementById(CellList[n]).style.backgroundColor=ColList[n];
> }
> }
> </script>
>
> and in your table
>
> <tr>
> <td id="a1" onMouseOver="cellbg('a1','#eeeeee');"
> onMouseOut="cellbg('a1','#ffffff');">a1</td>
> <td id="a2" onMouseOver="cellbg('a2','#eeeeee');"
> onMouseOut="cellbg('a2','#ffffff');">a2</td>
> <td><a href="#" onMouseOver="cellbg('a1,a2','#00ff00,#00ff00');"
> onMouseOut="cellbg('a1,a2','#ffffff',#ffffff);" onClick="return
> false;">row</a></td>
> </tr>
>
> the function can handle single or multiple cells and has been tested with

IE
> 6 and Netscape 7
>
> "NeoPhreak" <(E-Mail Removed)> wrote in message
> news:1xGXa.309$(E-Mail Removed)...
> > Any chance someone could please help me out by starting me off... I'd

> really
> > appreciate it!
> >
> > thnx
> > >.< NeoPhreak

> >
> > "Gill Bates" <(E-Mail Removed)> wrote in message
> > news:bgmivi$a1a$(E-Mail Removed)...
> > > you have to cycle through some colors (style attribute

background-color)
> > > with JavaScript and use setTimeOut
> > >
> > >
> > > "NeoPhreak" <(E-Mail Removed)> wrote in message
> > > newsmyXa.1539$(E-Mail Removed).. .
> > > > I am creating a menu for my site and I would like it so that when

the
> > > > onMouseOut even is triggered it will cause the cell of the table to

> fade
> > > out
> > > > back to the normal color with a delay.
> > > >
> > > > Can anyone help me to get started on how i would accomplish this?
> > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
Q: Automatically Changing Background Color of a Table Cell? Arthur Shapiro Javascript 29 01-02-2005 12:15 AM
changing a background image to a background colour? Dj Frenzy Javascript 3 02-10-2004 08:08 PM
Alternating Table Background Colour Alistair Birch Javascript 1 10-28-2003 01:31 AM
Table Cell Colour Change Blindsya HTML 1 09-17-2003 10:03 PM



Advertisments