gpt4 book ai didi

javascript - html5、javascript - 添加推文页面部分的功能

转载 作者:行者123 更新时间:2023-12-02 19:40:09 25 4
gpt4 key购买 nike

我一直在研究一个名为 TwitThis 的插件,但它用于发布您当前所在页面的地址/详细信息。

我想要实现的目标相当于:

(显然这只是概念性的,在有人说“你不能像你那样编码!”之前)

<ul>
<li>Short section of text <tweet button> </li>
<repeat ad nauseum>
</ul>

按下推文按钮将发布该 HTML 标签的内容

我知道这有点奇怪。

最佳答案

不需要 JS 库。使用Twitter Intents .

HTML:

<ul>
<li><span>some text</span><button>Tweet</button></li>
<li><span>some other text</span><button>Tweet</button></li>
</ul>​

JavaScript:

$('button').click(function() {
window.open("https://twitter.com/intent/tweet?text="+$(this).parent().find('span').text());
});​

Fiddle

关于javascript - html5、javascript - 添加推文页面部分的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10472800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com