SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing TD backgroundcolor on mouseover

    Hi all-

    Hoping one of you gurus can help me out w/ this one...

    I'm working on a global nav bar for an intranet portal.

    Nav bar is a 100% table w/ 1 row and a bunch of columns. Each TD has its own bacground image, and I and want to accomplish the following:

    on mouseover change the TD background from an image to a solid color; on mouse out, change the TD back to the background image.

    I've managed to get it to function, although makes a nasty little yellow javascript error in the browser w/ the following "ERROR: INVALID ARGUMENT"

    Here's the code for an individual TD:

    Code:
    <a href="/intranet/admin/index.php"> <td width="10%" align="center" onmouseover="this.style.backgroundColor='#CCCCCC'" onmouseout="this.style.background='/intranet/admin/images/globalNav_bg.jpg'">Administration</td></a>

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just use CSS for this?

    Code:
    <style type="text/css">
    TABLE.nav TD {
       background: #CCC;
       background-image: url(/intranet/admin/images/globalNav_bg.jpg);
    }
    TABLE.nav TD:hover {
       background-image: none;
    }
    </style>
    
    <table class="nav">
    ...
    <td>...</td>
    ...
    </table>
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks :)

    .


Bookmarks

Posting Permissions

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