使用Addthis.Com共享链接时如何将参数附加到URL [英] How Do I Append Parameters To Url When Using Addthis.Com To Share A Link
本文介绍了使用Addthis.Com共享链接时如何将参数附加到URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我正在开发的网站中添加Addthis Share按钮。但是随着要共享的链接,我需要传递一个变量,如查询字符串。
示例代码:
I am trying to add Addthis Share button in a website that i am developing. But along with the link that is to be shared I need to pass a variable like a query string.
Sample Code :
<script type="text/javascript" src="/js/addthis_widget.js"></script>
<a href="http://www.addthis.com/bookmark.php" id="divShare" runat="server"
class="addthis_button">Share
这就是我们实现分享按钮的方式。如何在共享社交媒体中的链接之前将数字或搅拌作为参数(查询字符串)附加到网址。
This is how we have implemented the share button. How can i append a number or stirng to the url as a parameter(query string) before sharing the link in social media.
推荐答案
因为你有runat = server你可以访问C#中的锚标签,但如果你想通过C#进行操作,我建议将其改为asp:超链接。
或者,你可以使用jQuery更改href属性:
Since you have runat = server you can access the anchor tag in C# although if you do want to do it via C# I would recommend changing it to an asp:Hyperlink instead.
Or, you can use jQuery to change the href attribute:
( #divShare)。attr( href,newUrl);
("#divShare").attr("href", newUrl);
另请注意,您将锚点标记divShare命名为暗示它是div。也许是一个更好的名字。
Also note, you named an anchor tag divShare which would imply it is a div. Perhaps a better name.
这篇关于使用Addthis.Com共享链接时如何将参数附加到URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文