Changing background colour in a table cell from a function

Discussion in 'Javascript' started by NeoPhreak, Aug 4, 2003.

  1. NeoPhreak

    NeoPhreak Guest

    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?
     
    NeoPhreak, Aug 4, 2003
    #1
    1. Advertising

  2. NeoPhreak

    Gill Bates Guest

    you have to cycle through some colors (style attribute background-color)
    with JavaScript and use setTimeOut


    "NeoPhreak" <> wrote in message
    news:xmyXa.1539$...
    > 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?
    >
    >
    >
     
    Gill Bates, Aug 4, 2003
    #2
    1. Advertising

  3. NeoPhreak

    NeoPhreak Guest

    Any chance someone could please help me out by starting me off... I'd really
    appreciate it!

    thnx
    >.< NeoPhreak


    "Gill Bates" <> wrote in message
    news:bgmivi$a1a$...
    > you have to cycle through some colors (style attribute background-color)
    > with JavaScript and use setTimeOut
    >
    >
    > "NeoPhreak" <> wrote in message
    > news:xmyXa.1539$...
    > > 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?
    > >
    > >
    > >

    >
    >
     
    NeoPhreak, Aug 5, 2003
    #3
  4. NeoPhreak

    NeoPhreak Guest

    Thanks!! Great Help!

    >.<NeoPhreak


    "Richard Hockey" <> wrote in message
    news:3f2f6909$0$11378$...
    > <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" <> wrote in message
    > news:1xGXa.309$...
    > > Any chance someone could please help me out by starting me off... I'd

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

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

    background-color)
    > > > with JavaScript and use setTimeOut
    > > >
    > > >
    > > > "NeoPhreak" <> wrote in message
    > > > news:xmyXa.1539$...
    > > > > 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?
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    NeoPhreak, Aug 5, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Blindsya

    Table Cell Colour Change

    Blindsya, Sep 17, 2003, in forum: HTML
    Replies:
    1
    Views:
    2,136
    David Dorward
    Sep 17, 2003
  2. Alistair Birch

    Alternating Table Background Colour

    Alistair Birch, Oct 27, 2003, in forum: Javascript
    Replies:
    1
    Views:
    163
  3. Dj Frenzy
    Replies:
    3
    Views:
    325
    Robert
    Feb 10, 2004
  4. Arthur Shapiro
    Replies:
    29
    Views:
    338
    Arthur Shapiro
    Jan 2, 2005
  5. jodleren
    Replies:
    2
    Views:
    208
    Thomas 'PointedEars' Lahn
    Jan 12, 2008
Loading...

Share This Page