View Full Version : Tweet Button

11-08-2012, 05:03 PM


Hope you are all well.

I am currently in the process of making a tweet button that once you press it opens a new window as normal when you are tweeting a url.

The problem I am having is that I want the tweet to show the text that the user has specified in a textarea above the tweet button. I've tried this code and it's not working.

Here's the Javascript code:

function tw_click() {
var url ='http://twitter.com/share?url=&text=' + encodeURIComponent(F.sel.id('socialmessage').value) + '&count=none'
window.open(url, 'sharer', 'toolbar=0,status=0,width=626,height=436');
return false

And html code for the button and textarea

<p><textarea id="socialmessage">Insert your tweet text here</textarea></p>
<input type="button" onclick="tw_click()" value="Tweet on Twitter" />

I would greatly appreciate any help given.