[英]Appending parent elements attribute to the URL of anchor tag href
<asp:Repeater runat="server" ID="rptStockListings">
<ItemTemplate>
<li rank=<%#GetRank(DataBinder.Eval(Container.DataItem,"r"))
...............
<a href="<%# DataBinder.Eval(Container.DataItem,"Url")
I have URL already but i want to append the rank attribute of li element which is ancestor of this anchor with href="Url". 我已经有URL,但是我想使用href =“ Url”追加li元素的rank属性,该元素是此锚的祖先。
How can I do that? 我怎样才能做到这一点?
Basically i want to pass information to the next opened page by anchor tag in the url itself. 基本上我想通过url本身中的定位标记将信息传递到下一个打开的页面。
Hope this helps 希望这可以帮助
<a onclick='openThis(<%# DataBinder.Eval(Container.DataItem,"Url"), this)'>Click here</a>
In javascript: 在javascript中:
function openThis(url, obj) {
var appendThis = $(this).closest("li").attr("rank");
window.open(url+appendThis + , "_self")
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.