• Advertisement
Sign in to follow this  

[web] Onclick TD link

This topic is 4592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey...here we go again. I'm just trying to get a <TD> tag to link to another page when you click anywhere inside the cell. I know this isn't right, but it's what I have so far:
<td onclick="href = 'http://www.spacelord/mother/mother.php';"> 
what am I doing wrong....err, how do I fix it? [smile]

Share this post


Link to post
Share on other sites
Advertisement
Something like this should work:


<table>
<tr>
<a href="http://www.google.com"<td>google</td></a>
</tr>
</table>


Share this post


Link to post
Share on other sites
Quote:
Original post by Kalasjniekof
Something like this should work:

*** Source Snippet Removed ***


That's not valid xhtml (ignoring the typo). Two ways are:


<table>
<tr>
<td onclick="window.location='http://someplace.com';">Click Meh</td>
</tr>
<tr>
<td><a href="http://someplace.com" style="text-decoration: none; color: black;">Click Meh</a></td>
</tr>
</table>



[google]


p.s.

If the table cell is wider than the link, you can add "display: block; width: 100%;" to the style. Oddly enough Firefox only needs "display: block;" and IE only needs "width: 100%;" for that to work.

[Edited by - Ternary on June 28, 2005 1:48:22 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement