stormist
asked on
Making an entire row on a table into a link, setting font color on A style
I have a table row that I generate with PHP that shows up as follows:
<tr ><th scope="row"><a href="showlisting.php?mess ageid=1">1 1/5/06</a> </th><th>< a href="showlisting.php?mess ageid=1">M otorola V3</a></th><th><a href="showlisting.php?mess ageid=1">1 00</a></th ><th><a href="showlisting.php?mess ageid=1">N ew</a></th ><th><a href="showlisting.php?mess ageid=1">T est Corp</a></th><th class="msg"><a href="showlisting.php?mess ageid=1">M otorola is one of several companies which has high sales in the clamshell seg..</th></tr></a> <tr ><th scope="row">11/3/2006</th> <th>Nokia 9000</th><th>1000</th><th> New</th><t h>Test Corp.</th><th class="msg">New in box, OEM chargers, OEM battery, Comes with 30 day Warranty fro..</th>
as you can see, I repeat the link for each value. I tried encompassing the whole row in a <a href> tag but it doesn't seem to work. Is there a way to make the whole row clickable? I would really like the whole row including the spaces between each column to be clickable as well, because I highlight the entire row when the mouse scrolls over it. Another problem I have is I set the A attributes as follows:
<style type="text/css">
A {
text-decoration:none;
}
</style>
so that the links are not underlined. The problem is it turns each values into the column a gray color. I tried setting the font color within that tag back to black but it doesn't seem to work. Any ideas? Thanks!
<tr ><th scope="row"><a href="showlisting.php?mess
as you can see, I repeat the link for each value. I tried encompassing the whole row in a <a href> tag but it doesn't seem to work. Is there a way to make the whole row clickable? I would really like the whole row including the spaces between each column to be clickable as well, because I highlight the entire row when the mouse scrolls over it. Another problem I have is I set the A attributes as follows:
<style type="text/css">
A {
text-decoration:none;
}
</style>
so that the links are not underlined. The problem is it turns each values into the column a gray color. I tried setting the font color within that tag back to black but it doesn't seem to work. Any ideas? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you cannot have block level elements inside inline elements, tr's and td's are block, a is inline.
for highlighting you could do this:
<tr title="Clickable table row" onClick="window.location.h ref = ''showlisting.php?messagei d=1''" onMouseOver="this.style.cu rsor='hand '; this.bgColor = 'gray'; " onMouseOut ="this.bgColor = 'white'">
<td>asdasdasdasd</td></tr>
for the hyperlink colours, try setting for the different states, like this:
a:link, a: visited{color: black; text-decoration: none;}
a:hover, a:active{color: blue; text-decoration: underline;}
for highlighting you could do this:
<tr title="Clickable table row" onClick="window.location.h
<td>asdasdasdasd</td></tr>
for the hyperlink colours, try setting for the different states, like this:
a:link, a: visited{color: black; text-decoration: none;}
a:hover, a:active{color: blue; text-decoration: underline;}
sorry, no space between a: and visited
ASKER
That solution was perfect thanks! I do appreciate your time and effort.
try <tr onclick="window.location.h