SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Hyperlink a row?
-
Sep 14, 2006, 10:12 #1
- Join Date
- Jan 2004
- Location
- Temecula, CA
- Posts
- 188
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hyperlink a row?
Anyone know how to hyperlink a row? I want the whole row to be linked:
Code:<a href='WebStatsYearsAndPeriods.php'> <tr> <td>$Year</td> <td>$Period</td> </tr> </a>
-
Sep 14, 2006, 10:53 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
row link
Maybe
HTML Code:<tr> <td><a href='WebStatsYearsAndPeriods.php'>$Year</a></td> <td><a href='WebStatsYearsAndPeriods.php'>$Period</a></td> </tr>
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Sep 14, 2006, 11:02 #3
- Join Date
- Jan 2004
- Location
- Temecula, CA
- Posts
- 188
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Surely that does produce a similar effect, but without a bunch of Javascript, it doesn't produce the a:link, a:hover, a:visited effect. Instead it gives the impression that there are two individual links per row, whereas the idea is for there to be one link for the entire row.
It's a puzzlement! I just don't get why it doesn't work.
-
Sep 14, 2006, 11:58 #4
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
row link
It must be something to do with block level elements as opposed to inline elements and what can be inside what. Have you tried
HTML Code:<tr> <a href='WebStatsYearsAndPeriods.php'> <td>$Year</td> <td>$Period</td> </a> </tr>
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Sep 14, 2006, 19:25 #5
- Join Date
- Jan 2004
- Location
- Temecula, CA
- Posts
- 188
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I just tried it. Same results -- nothing.
I think you're right; it's got something to do with the block level status of the elements in question. I should stop wondering about it and read up on the subject. Wouldn't be surprised to find the W3C docs saying "you can't hyperlink a row!"
-
Sep 14, 2006, 20:09 #6
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
bock - inline
It seems that table, tr, and td are block level elements (I don't see why td would be, but .... ) and a is an inline element. Inline elements can only have other inline elements in them, so table, tr, and td are out. http://www.ahuka.com/htmllevel1/blocklevel.html
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Sep 14, 2006, 22:12 #7
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Mittineague
If TDs were inline elements, you couldn't put anything but inline elements into them. Sometimes you may want to put an UL or OL, or even a DIV, inside a TD. Thus the TD must be a block-level element.
@cweaver: there is no way to create a link out of an entire table row, using only HTML. You could do it with JavaScript, or if you're just after the :hover effect you can fake that with CSS in modern browsers. (IE won't play along, though.)Birnam wood is come to Dunsinane
Bookmarks