posted 20 years ago
hi,
The solution for this lies in the naming convention which we need to follow while naming the cells for "name", "id" and the button columns.
I am giving this solution assuming that data in ID columns is unique in each row.
We can set id attribute of cell in the "NAME" column in this format for each row, "tdName<id>".
Similarly, the id attribute for cell in the "ID" column will be in the format of "tdId<id>".
And the value for id attribute of the button will be "btn<id>".
By doing like that, we can have unique names for the contents of each cell.
Hence, on click of the button, you can pass the button's id as the attribute to the javascript function.
As we know the prefix, knowing button of which row has been clicked can be done easily.
I think you know that an input widget can be operated based on its ID in the javascript like this "document.getElementById(<widget-id>)" .
<%
while(resultsetobject.next())
{
%>
<tr>
<td id="tdName<%=rs.getString("id")%>"><%=rs.getString("name")%></td>
<td><%=rs.getString("id")%></td>
<td><input type="button" id="btn<%=rs.getString("id")%>" value="Edit" name="edit can you tell me what will come on" click="function(this.id)"></td>
</tr>
<%
}
%>
[ March 07, 2005: Message edited by: Hemanth Pallavajula ]
Cheers,<br />Hemanth...<br />(When opportunity doesn't knock, build a door.)