我想知道如何单击HTML表中的按钮并获取返回给我的行和列号:例如,使用下表:
<table>
<tr>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
</tr>
<tr>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
</tr>
<tr>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
<td><input type="button" value="button"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我如何使用JavaScript点击第二行中的第一个按钮并让它告诉我,我点击了第二行中的第一个单元格?每个按钮是否需要具有唯一ID?