table里每一行都有一个checkbox,选中一行后,怎么得到该行特定或者所有TD数据

table里每一行都有一个checkbox,选中一行后,怎么得到该行特定或者所有TD数据

问题描述:

table里每一行都有一个checkbox,选中一行后,怎么得到该行特定或者所有TD数据

<tr>

    <th width="30px" align="center">
        <input name="chkAll" type="checkbox" value="checkbox" onclick="CheckAll(this)" />
     </th>
    <th width="80px" align="center" scope="col">序号</th>
    <th width="80px" align="center" scope="col">资源类型</th>
    <th width="100px" align="center" scope="col">单据号</th>
    <th width="100px" align="center" scope="col">所属部门</th>
    <th width="80px" align="center" scope="col">状态</th>

</tr>

下面tr显示多行数据 由 JQuery 自动生成 格式和上面一样,我要怎么才能获取所有checkbox 为选中的 一行所有 或者 行中特定的 TD的数据

 

急!!! 在线等

[code="html"]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



Untitled
<br> function test(o) {<br> if (!o.checked) {<br> return;<br> }<br> var tr = o.parentNode.parentNode;<br> var tds = tr.cells;<br> var str = &quot;you click &quot;;<br> for(var i = 0;i &lt; tds.length;i++){<br> if (i &lt; 3) {<br> str = str + tds[i].innerHTML + &quot;--&quot;;<br> }<br> }<br> alert(str);<br> }<br>

b1 b2 b3
c1 c2 c3


[/code]

说不清楚~~~ 不知道你的js是怎么封装的。

value="/c:out"
MEDIID="/c:out"
STAGE="/c:out"
ISJBYW="/c:out" />

这种方式存放数据!

所有的数据列表中都有这么个input Name都是box
然后在 在js中呢 getElementsByName('box') 对象都获取了,别的还不能吗。