Results 1 to 4 of 4
  1. #1

    table bg color change

    Im going to be programming a website and i was wondering what the code is when you put your mouse over a table cell it changes the table cells background color as well as the text in the cells color, this is for a navigation bar im going to be making.
    -Tyler

    http://www.beauxbatonsonline.com
    [email protected]

  2. #2
    Join Date
    May 2004
    Location
    Singapore
    Posts
    262
    Access the DOM with something like:

    this.style.background
    this.style.color
    #include<cstdio>
    char*s="#include<cstdio>%cchar*s=%c%s%c;%cint main(){std::printf(s,10,34,s,34,10);}";
    int main(){std::printf(s,10,34,s,34,10);}

  3. #3
    Join Date
    May 2004
    Location
    World Wide Web
    Posts
    1,129
    Try the following:

    <tr>
    <td onmouseover="bgColor='#99ccff'" onmouseout="bgColor='#eeeeee'" bgcolor="#eeeeee">
    <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><A HREF="404.htm" style="text-decoration:none">&nbsp;&raquo;
    Index</a></font></div></td>
    </tr>
    Real Value Hosting - Every day hosting solutions since 2003
    Shared Hosting Reseller Hosting VPS Dedicated Servers True 24 x 7 x 365 Support

  4. #4
    Join Date
    May 2004
    Location
    Bangalore
    Posts
    8
    Try with following sample script

    <html>
    <head>
    <script type="text/javascript">
    function call(txt)
    {
    txt.bgColor='red';
    txt.style.color='yellow';
    }
    function clearing(cell)
    {
    cell.bgColor='white';
    cell.style.color='black';
    }
    </script>
    </head>
    <body>
    <table border=2>
    <tr>
    <td id='c1' onmouseover="call(c1)" onmouseout="clearing(c1)">Cell 1</td>
    <td id='c2' onmouseover="call(c2)" onmouseout="clearing(c2)">Cell 2</td>
    <td id='c3' onmouseover="call(c3)" onmouseout="clearing(c3)">Cell 3</td>
    <td id='c4' onmouseover="call(c4)" onmouseout="clearing(c4)">Cell 4</td>
    </tr>
    </table>
    </body>
    </html>

    ___________________________________

    - Geetha.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •