js部分:
复制代码 代码如下:
var checkboxs = document.getElementsByTagName("input");
for(var i=0;i<checkboxs.length;i++)
{
if(checkboxs[i].type=="checkbox" && checkboxs[i].checked==true){
var trobj=checkboxs[i].parentNode.parentNode; //找到tr节点
if(trobj.rowIndex > 0){
var tdobj=trobj.children;
var amount = tdobj[3].children.item(0).value; //找到td节点的value 对应第4个td
alert(amount);
}
}
}
html的repeater
复制代码 代码如下:
<asp:repeater id="repeater1" runat="server">
<ItemTemplate>
<tr>
<TD>
<input type =checkbox name="checkboxs" ID="checkbox" Runat="server" Width="15" value = '<%# Container.DataItem("mocode") %>'/>
</TD>
<td>
<asp:ImageButton id="btnkxcode" runat="server" Width="15" ImageUrl="../image/search.jpg" CommandName="btnkx"
Height="15"></asp:ImageButton>
<asp:TextBox id="ckxcode" runat="server" CssClass="TextBox1" Text='<%# Container.DataItem("itemtype") %>'>
</asp:TextBox></td>
<td>
<asp:ImageButton id="btnkxname" runat="server" Width="15" ImageUrl="../image/search.jpg" CommandName="btnkxn"
Height="15"></asp:ImageButton>
<asp:TextBox id="ckxname" runat="server" CssClass="TextBox1" Text='<%# Container.DataItem("itemname") %>'>
</asp:TextBox>
</td>
<td>
<asp:TextBox id="amount" runat="server" CssClass="TextBox1" Text='<%# Container.DataItem("ysamount") %>'>
</asp:TextBox></td>
</tr>
</ItemTemplate>
</asp:repeater>