我不知道JQuery,所以我希望有一種方法可以在純JavaScript中執行此操作。單擊表格行並獲取所有單元格的值
我需要單擊一個表格行並獲取該行中每個單元格的值。這裏是我的表的格式:
<table class='list'>
<tr>
<th class='tech'>OCB</th>
<th class='area'>Area</th>
<th class='name'>Name</th>
<th class='cell'>Cell #</th>
<th class='nick'>Nickname</th>
</tr>
<tr onclick="somefunction()">
<td>275</td>
<td>Layton Installation</td>
<td>Benjamin Lloyd</td>
<td>(801) 123-456</td>
<td>Ben</td>
</tr>
</table>
反正有沒有把每個單元格的唯一ID?
你可以某種'這個for'循環。 – Sethen 2013-05-07 18:36:13