我jsp有多个table。现在我要点击一行数据,是点一行的任何地方,就得到这一行的第一个input(checkbox)的 value。求js代码
<table class="grid2" id="stufflist" width="100%">
<thead>
<tr>
<th><input id="checkAllBox" name="checkAllBox" type="checkbox" onclick="ctlBox_click()"/></th>
<th>材料编码</th>
<th>材料名称</th>
<th>品牌</th>
<th>规格型号</th>
</tr>
</thead>
<c:forEach items="${vo}" var="item">
<tr style="height:35px" id="linkage">
<td>
<input type="checkbox" id="checkbox" name="checkbox" value="${item.pkId}"onclick="mailBox_click()"/>
</td>
<td><input type="text" value="${item.snStuff}" name="snStuff"/></td>
<td><input type="text" value="${item.naStuff}" name="naStuff"/></td>
<td><input type="text" value="${item.idBrand}" name="idBrand"/></td>
</tr>
</c:forEach>
</table>
加一段Jquery代码即可,要先引用jquery库:
<script type="text/javascript">