Forum Moderators: open

Message Too Old, No Replies

how to get the selected row

how do I get the row in a table when a column is clicked in that table

         

sireesha

11:32 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Hi,
When I click on a column of a table, I want to know which row this column belongs to. How do I get the row id to which this clicked column belongs to?

Thanks,
Sireesha

Alternative Future

11:49 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi sireesha,

Not sure if i have fully understood your requirement, but does the following code do what you are requesting? If not i'll try to answer the requiremnet with some more details...

<html>
<head>

</head>
<body>

<table>
<tr id="row1">
<td id="1.1" onclick="alert(document.getElementById('row1').id)">1.1</td>
<td id="1.2" onclick="alert(document.getElementById('row1').id)">1.2</td>
</tr>
<tr id="row2">
<td id="2.1" onclick="alert(document.getElementById('row2').id)">2.1</td>
<td id="2.2" onclick="alert(document.getElementById('row2').id)">2.2</td>
</tr>
</table>

</body>
</html>

-george

DrDoc

3:53 pm on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would something like this work?
[webmasterworld.com...]