PDA

View Full Version : Can I make an entire <td> field 'clickable'?



DowntownEER
07-17-2006, 05:14 PM
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!

jscheuer1
07-17-2006, 07:12 PM
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:


<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.

DowntownEER
07-18-2006, 04:50 PM
Thanks!

mburt
07-22-2006, 04:36 PM
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

jscheuer1
07-23-2006, 04:20 AM
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.

mburt
07-23-2006, 01:42 PM
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.

jscheuer1
07-23-2006, 04:04 PM
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.