如何将主题标签添加到自定义推特按钮?

问题描述

| 我正在尝试创建一个带有弹出窗口的自定义推特按钮,此部分有效。但是,我无法使其在文本区域中发布主题标签。 推文内容
url=http://www.mywebsite.com&text=mytweetcontent&via=mytwitterusername
在&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>
编辑*评论回复 谢谢你的建议!我没有尝试使用标签,只是正常,但将&更改为?删除内容区,下面的代码。第一行是tweet框中的结果,下面是相应的URL。 mycontent通过@myusername http://t.co/nKb4nWC
http://twitter.com/intent/tweet?text=mycontent&url=http%3A%2F%2Fwww.mywebsite.com&via=myusername
通过@myusername http://t.co/YzrDfzX
http://twitter.com/intent/tweet?url=http%3A%2F%2Fwww.mywebsite.com%3Ftext%3Dmycontent&via=myusername
    

解决方法

        使用以下内容有什么问题?
<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>
    ,        
<a href=\"https://twitter.com/share?url=<?php echo $SiteConfig->GetBaseURL(); ?>rise-challenge.php&text=Do you have what it takes to spark the rise? Click here to rise to the challenge&hashtags=sparktherise\" class=\"socialLinkTwitter twitter\" title=\"Twitter\" target=\"_blank\">Twitter</a>

<script type=\"text/javascript\">
    $(\'.socialLinkTwitter\').click(function (e) {
        e.preventDefault();
        var sTwitterShare = $(this).attr(\'href\');
        window.open(sTwitterShare,\'Share\',\'width=550,height=450\');
    });
</script>
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...