Results 1 to 7 of 7

Thread: Can I make an entire <td> field 'clickable'?

  1. #1
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can I make an entire <td> field 'clickable'?

    Hi. I'd like to make entire <td> cells of a table 'clickable' for navigation (instead of having an href element inside of the cell).

    Can anybody help?

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could do that with an onclick event for the cell but, that would require the user to have javascript enabled. It would be better to use plain HTML, like so:

    HTML Code:
    <td><a href="whatever.htm" style="display:block;width:100%;height:100%;text-decoration:none;">&nbsp;</a></td>
    If you have content for the cell, it could replace the &nbsp; entity. The text-decoration:none; is optional if you have content.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    or, you could do this:
    <table>
    <tr>
    <td style="cursor:hand" onclick="window.location.href = 'http://www.dynamicdrive.com/'">Blah.. You can put any text here.</td>
    </tr>
    </table>

    Just another option
    - Mike

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by mburt
    or, you could do this:
    <table>
    <tr>
    <td style="cursor:hand" onclick="window.location.href = 'http://www.dynamicdrive.com/'">Blah.. You can put any text here.</td>
    </tr>
    </table>

    Just another option
    That solution requires javascript enabled. Unless you are trying to restrict the use of your site to javascript enabled browsers, it is a bad choice.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay, thanks jscheuer1.
    But in your option you have to have use css, which some browsers don't support, so it is a tricky decision.
    - Mike

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What browsers don't support css? I would like to know as, I can't think of any. However, even those that do not will still show a link of some sort that could still be clicked on to navigate to the resource.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •