PDA

View Full Version : <tr> link problem in chrome and firefox


scorpx
09-02-2009, 07:55 AM
I wanna make all tr to link. use this code

<a href="http://www.google.com/ " target="_blank">
<tr>
<td>google</td>
<td>bla bla</td>
<td>bla bla</td>
</tr></a>

it works in IE but don't work in firefox and chrome ?

is there any idea ?

Thanks...

yell0wdart
09-02-2009, 04:23 PM
That bit of HTML is not valid. A <table> element should only have <tbody> or <tr> children. An <a> there is not kosher. Validate your markup here to maximize your cross-browser compatibility: http://validator.w3.org/

The best the browser can do is try to figure out how the heck to manage your malformed HTML. IE seems to do an OK job, but FF and webkit browsers (Safari/Chrome) don't seem to know what to do with it.

scorpx
09-02-2009, 08:39 PM
thanks yell0wdart.

Soo I can't use <a> to make <tr> link.

Maybe using little java script can solve the problem.

Thanks...

jasonJ
09-02-2009, 08:52 PM
Use this if you really need to stick to the table:

<table>
<tr onclick="location.href='http://www.google.com';">
<td>google</td>
<td>bla bla</td>
<td>bla bla</td>
</tr>
</table>

Note that you can't open the link in a new window using the middle button of your mouse.
But frankly, I can't see the point in those <tr> and <td> here...