I have an HTML table with many rows and columns with each row containing info about one specific item and a delete link (there is a delete link for each row). What I want to do is to highlight the whole row (<tr> element) in the table (with a different background color) when I click on the delete link of that row (the new page opens in a new window.)
My question is:
How do I highlight (by changing the bg color for the whole <tr> element or -if that’s not possible- all of that row’s <td> elements) the row if I have clicked the delete link in that row. I want the row to stay highlighted so that I would know what rows were deleted.
I guess this’ll require id-specific actions applied to the row <tr> or all of its cells with an onclick event in that rows delete link.
EDIT: Thanks Azmeen, bosko! I was on the reply page for a while and didn’t notice your replies!
Just found it!
Hope someone finds it useful.
<html>
<head>
<script type="text/javascript">
function visited(a) {
tr = a.parentNode.parentNode;
tr.style.backgroundColor = "red";
}
</script>
</head>
<body>
<table>
<tr>
<td>This row will be highlighted in red after you...</td>
<td>Click on the following link</td>
<td><a href="http://google.com" target="_blank" onclick="visited(this)">Google</a></td>
</tr>
</table>
</body>
</html>