0
<ItemTemplate>
<td id="tdtmp" runat="server">
<div id="divRef" class="divRef">
<asp:Literal ID="lblRef" Text="<%$ Resources:V_Tableaux, refer %>" runat="server"></asp:Literal>
<asp:Label ID="reference" ClientIDMode="Static" CssClass="txtRef" Text='<%# Eval("Reference") %>' runat="server" />
<span id="spanDetails" class="spanDetails"><%=Resources.V_Tableaux.detail%></span>
<div id="divAddCart" class="divAddCart">
<img id="checkCart" width="30" height="30" src="Medias/Config/Valid.png"
title="<%=Resources.V_Tableaux.AddToCart%>" />
</div>
</div>
<div id="divImg" class="divImgTxt">
<img id="PathImage" runat="server"
src='<%# Eval("PathImage") %>'
alt="PathImage"
title="<%=Resources.V_Tableaux.TitleimgClickZoom%>"
align="left"
style="margin-right: 10px;" />
'<%# Eval("TexteImage")%>'
</div>
<div id="tdItemTemplate" class="tdItemTemplate" style="display:none">
<div class="divItemTemplate">
<asp:Literal ID="Literal1" Text="<%$ Resources:V_Tableaux, prix %>" runat="server" />
<asp:Label ID="prix" CssClass="txtLabel" Text='<%# Eval("Prix") %>' runat="server" />
<br />
<asp:Literal ID="Literal2" Text="<%$ Resources:V_Tableaux, hauteur %>" runat="server" />
<asp:Label ID="Hauteur" CssClass="txtLabel" Text='<%# Eval("Hauteur") %>' runat="server" />
<br />
<asp:Literal ID="Literal3" Text="<%$ Resources:V_Tableaux, largeur %>" runat="server" />
<asp:Label ID="Largeur" CssClass="txtLabel" Text='<%# Eval("Largeur") %>' runat="server" />
</div>
<div class="divItemTemplate1">
<asp:Literal ID="Literal4" Text="<%$ Resources:V_Tableaux, toile %>" runat="server" />
<asp:Label ID="Label1" CssClass="txtLabel" Text='<%# Eval("Type_de_Toile") %>' runat="server" />
<br />
<asp:Literal ID="Literal5" Text="<%$ Resources:V_Tableaux, peinture %>" runat="server" />
<asp:Label ID="Label2" CssClass="txtLabel" Text='<%# Eval("Type_Peinture")%>' runat="server" />
<br />
<asp:Literal ID="Literal6" Text="<%$ Resources:V_Tableaux, dateacq %>" runat="server" />
<asp:Label ID="Label3" CssClass="txtLabel" Text='<%# Eval("Date_Acquisition") %>' runat="server" />
</div>
<div class="divItemArtiste">
<asp:Literal ID="Literal7" Text="<%$ Resources:V_Tableaux, peintre %>" runat="server" />
<asp:Label ID="Label4" CssClass="txtLabel" Text='<%# Eval("Peintre")%>' runat="server" />
</div>
</div>
<br />
</td>
</ItemTemplate>
> Blockquote
jQuery代碼:jQuery選擇parentsUntil
var ImgCart = $('.divAddCart').find('img');
ImgCart.click(function (e) {
e.preventDefault();
var idref = $(this).parentsUntil("tr");
idref.css("background-color", "red"); //ok i see the bac color
var vbref = idref.find("div> #reference").text(); //ok i get the reference value
var vbH = idref.find("#Hauteur"); // From herre i cant get the text element ???
var vbL = idref.find("#Largeur");
var description = "Tableaux artiste: " + $.trim(vbH.text()) + "x" + vbL.text();
var vbPrix = idref.find("#price");
var Qte = 1;
var PrixTotal = Qte * vbPrix.text();
var sqlStr = Qte + "', '" + vbref + "', '" + description + "', '" + vbPrix.text() + "', '" +
});
如何獲得VBH的價值? 我的意思是在parentUntil之後的「tdtmp」選擇器「idref」點。 tr是表listview的成員,並且是table-tbody之後的頂級節點。 有人可以幫我解決這個問題 謝謝
非常感謝這工作正常 –