How to add a hashtag to a custom tweet button?

I am trying to create a custom tweet button with a popup menu, this part works. However, I cannot get it to place hashtags in the text area.

Tweet content

url=http://www.mywebsite.com&text=mytweetcontent&via=mytwitterusername 

In & text =, I experimented using mytweetcontent + # myhashtag, and also tried to encode URL% 23 (which corresponds to #); however, I still cannot get the hashtag. Any ideas on what I can do? I would prefer to have my own image, so I don't use the proprietary jscript twitter button. Many thanks for your help!

Full code for reference:

 <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> 

Edit * Reply to comment

Thanks for the offer! I have not tried with hashtag, just fine, but changing and so on? deletes the content area, code below. The top line is the result in the tweet box, below the corresponding url.

mycontent http://t.co/nKb4nWC via @myusername

 http://twitter.com/intent/tweet?text=mycontent&url=http%3A%2F%2Fwww.mywebsite.com&via=myusername 

http://t.co/YzrDfzX via @myusername

 http://twitter.com/intent/tweet?url=http%3A%2F%2Fwww.mywebsite.com%3Ftext%3Dmycontent&via=myusername 
+4
source share
2 answers

What happened using the following?

 <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> 
+5
source
 <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> 
+2
source

All Articles