Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I make a td a link?

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
I have a series of td's with a background image, and a two word title, like "About Us" which is the actual link, but people think that the image is the link, and they are having problems. Can I make the whole td a link? How?


Thanks
 


Perhaps something like this:

Code:
<table width="300" border="1">
<tr>
<td style="cursor: default" onclick="location.href='the_page.html'" onmouseover="this.style.cursor = 'pointer';"><a href="the_page.html">About Us</a></td>
</tr>
</table>

Note: the reason for the initial cursor style setting is because some browsers will not allow you to change the style of an object unless it already exists.

You can take the onmouseover out of the tag, it just makes it more easily understandable that you can click on the entire TD, rather than just the link.

Hope this helps.

*cLFlaVA
----------------------------
Ham and Eggs walks into a bar and asks, "Can I have a beer please?"
The bartender replies, "I'm sorry, we don't serve breakfast.
 
Sorry, you might want to set the onmouseout event too:

[tt]onmouseout="this.style.cursor = 'default';"[/tt]

*cLFlaVA
----------------------------
Ham and Eggs walks into a bar and asks, "Can I have a beer please?"
The bartender replies, "I'm sorry, we don't serve breakfast.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top