Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    changing background colors of a <td>

    Hi,
    Can somebody help me with changing the background color of a table cell (<td>)? I'm not sure how to do it.

    I would like to be able to rollover the table cell and have it change colors. I imagine that this would be possible using a onMouseOver. Is there any more JS required other than that single attribute?


    thanks,
    Justin

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    New York, USA
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sort of:
    You can throw this into your td tag
    onmouseover="this.style.backgroundColor='blue';"
    (use the same with onmouseout to change it back)

    However this won't work in NS4, you'll need to deal with layers to get the same effect. Search around http://www.javascriptkit.com . There was a tutorial there for exactly that. That is if your one of those people who still cares about NS4
    hope that helps

  • #3
    Registered User
    Join Date
    Jul 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey thanks a lot!

    now I have another problem...how do i get that table cell to be able to link to another page. So not only is the text in the cell a link, but rather the whole cell is a link.

    i can't just put an href tag in the <td> tag can I?


    thanks again,
    justin
    Last edited by juh915; 07-30-2002 at 12:58 AM.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    <td style="cursor:hand;" onclick="window.location='URL'">


  •  

    Posting Permissions

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