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 class="TableDetail2">
<TD>
<input type =checkbox name="checkboxs" ID="checkbox" Runat="server" Width="15" value = '<%# Container.DataItem("mocode") %>'/>
</TD>
<td class="nowrap">
<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 class="nowrap">
<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 class="nowrap">
<asp:TextBox id="amount" runat="server" CssClass="TextBox1" Text='<%# Container.DataItem("ysamount") %>'>
</asp:TextBox></td>
</tr>
</ItemTemplate>
</asp:repeater>