Making a <TD> clickable instead of just the text

admin

Administrator
Staff member
I have a bit of code that I'm using on my intranet site (see red code: <!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=10171">http://www.htmlforums.com/showthread.ph ... adid=10171</a><!-- m --> )and was wondering if there is any way to href the actual cell instead of just the text? I would rather use text instead of images, but I want the same effect of being able to click inside of the box instead of directly on the text.<br />
<br />
By the way, I have it set up to where the cursor turns into a hand while in the <td>, although it doesn't lead you anywhere unless you click directly on the text.<br />
<br />
Help, please!<!--content-->for ie only coudn't you just put the <td> inside the <a href> tag.<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"whatever"><td>text</td></a><br />
<br />
I think that is how it is. but NS doesn't like it. I know you don't use NS but just to let you and everybody else know.<!--content-->Thanks for the help. It worked perfectly!<br />
<br />
BTW, the entire code I'm using for for those two tables doesn't work on NetsCrap anyway, so putting the href in fron of the <td> shouldn't really do any more damage.<br />
<br />
Once again, thanks for the help!<!--content-->Ummmmm,<br />
I wouldn't recommend swapping the order of the <td> and <a> tags. Although Internet Explorer can handle it, as the world embraces XML little tricks like this are liable to stop working.<br />
All you need to do is add an onclick() event to the <td>.<br />
<td... onclick="window.location='www.somesite.com/somepage.html'"><!--content-->I would still need to put cursor:hand in the stylesheet though, right?<!--content-->Originally posted by jonhanlon <br />
Ummmmm,<br />
I wouldn't recommend swapping the order of the <td> and <a> tags. Although Internet Explorer can handle it, as the world embraces XML little tricks like this are liable to stop working.<br />
All you need to do is add an onclick() event to the <td>.<br />
<td... onclick="window.location='www.somesite.com/somepage.html'"> <br />
I agree Jon, but the only reason I suggested it was because he said it was for his Intranet and the world wouldn't se it in the first place.<!--content-->I'd like to know all my options when it comes to this stuff. When I get out of the military, I think I'm going to pursue this as a career.<br />
<br />
So, bring on the tips!<!--content-->oh yes I don't blame you. I like to keep up on all the tips even if I don't use them.<!--content-->Ok, well then I am going to throw my two cents worth into the ring.<br />
<br />
IMHO . . . I think that intranet or not, the code should be something that you'll be able to change or upgrade somewhere along the line, and that means using coding techniques that will change or upgrade easily.<br />
<br />
Having converted *waaay too many* sites from Frontpage generated code (affectionately referred to as "crap code" where I work) into something that is cross-browser friendly or something that can eventually be re-written in XML, I know that it may take longer to write correct code at the outset, but it'll save A LOT of time later on.<br />
<br />
Do it right now so you don't have to do it again later. . . use the 'onclick' event.<br />
<br />
<br />
<br />
-beth<!--content-->Already changfed it to "onclick".<br />
Thanks for the help, though!<!--content-->
 
Back
Top