如何在自定义推文按钮中添加主题标签?

ahu*_*ng7 4 javascript twitter jquery ruby-on-rails

我正在尝试使用弹出窗口创建自定义推文按钮,这部分可行.但是,我无法在文本区域中发布主题标签.

推文内容

url=http://www.mywebsite.com&text=mytweetcontent&via=mytwitterusername
Run Code Online (Sandbox Code Playgroud)

在&text =我尝试过使用mytweetcontent + #myhashtag以及尝试使用URL编码%23(与#对应); 但是,我仍然无法显示标签.关于我能做什么的任何想法?我更喜欢自定义图像,这就是为什么我没有使用专有的twitter jscript按钮.非常感谢您的帮助!

完整代码供参考:

<a href="javascript:(function(){window.twttr=window.twttr||{};var     D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C>A){G=Math.round((C/2)-(A/2))}window.twttr.shareWin=window.open('http://twitter.com/share?url=http://www.mywebsite.com&text=%23+mytweetcontent&via=mytwitterusername','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='http://platform.twitter.com/widgets.js';F.getElementsByTagName('head')[0].appendChild(E)}());"><img src="twitter-logo.png" border="0"></a>
Run Code Online (Sandbox Code Playgroud)

编辑*回复评论

谢谢你的建议!我没有尝试使用hashtag,只是正常,但更改&到?删除内容区域,代码如下.顶行是推文框中的结果,下面是相应的网址.

mycontent http://t.co/nKb4nWC来自@myusername

http://twitter.com/intent/tweet?text=mycontent&url=http%3A%2F%2Fwww.mywebsite.com&via=myusername
Run Code Online (Sandbox Code Playgroud)

http://t.co/YzrDfzX来自@myusername

http://twitter.com/intent/tweet?url=http%3A%2F%2Fwww.mywebsite.com%3Ftext%3Dmycontent&via=myusername
Run Code Online (Sandbox Code Playgroud)

Mar*_*cel 5

使用以下内容有什么问题?

<a href="http://twitter.com/intent/tweet?text=Text%20%23hashtag&amp;via=JohnDoe"
    onclick="return !window.open(this.href, 'tweet', 'menubar=no')">
    <img src="twitter-logo.png">
</a>
Run Code Online (Sandbox Code Playgroud)