HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Making a td a link
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table
View previous topic :: View next topic  
Author Message
Eli McGowan



Joined: 12 Aug 2005
Posts: 4
Location: http://www.elimcgowan.com

PostPosted: Fri Aug 12, 2005 1:20 pm     Making a td a link Reply with quote

I know how to make a link inside the <td></td> tags:
<table>
<tr>
<td>
<a href="website.html">Click Here!</a>
</td>
</tr>
</table>

But, can I make an entire td a link? The following code doesn't seem to work:
<table>
<tr>
<a href="website.html">
<td>
Click Here!
</td>
</a>
</tr>
</table>

I would like to be able to click anywhere in the the cell to link. Is it possible? How?

Thanks
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8426
Location: Castle Pines North, CO USA

PostPosted: Fri Aug 12, 2005 6:54 pm     Reply with quote



The easiest would be to make an image and insert that image into the cell, else JS might be a method but not all that great
gary.newelluk



Joined: 12 May 2005
Posts: 548
Location: Peterhead, Scotland

PostPosted: Sat Aug 13, 2005 2:06 pm     Reply with quote

You can use the onclick event of the <td> tag to link to another page for example:

Code:

<table border=1>
<tr>
<td onclick="window.location.href='http://www.newellwebservices.co.uk'">Click here for my website</td>
</tr>
</table>


You can make it look like a link by using the onmouseover event to change the cursor etc.
Eli McGowan



Joined: 12 Aug 2005
Posts: 4
Location: http://www.elimcgowan.com

PostPosted: Fri Aug 26, 2005 6:36 pm     Thanks! Reply with quote

Exactly what I was looking for. Thank You very much!
Sloth



Joined: 15 Aug 2008
Posts: 1

PostPosted: Fri Aug 15, 2008 4:04 pm     Reply with quote

what if I want to keep the href style?

(as in
A:link, A:visited, A:active, .xxmenu a.set2:link, .xxmenu a.set2:visited, .xxmenu a.set2:active {color: #0000ff; text-decoration: none}

A:hover, .xxmenu a.set2:hover {color: #ff0000; text-decoration: none})

I've been trying to do it for a while now.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial