/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<a href="http://twitter.com/home?status=Just read post by @rodneyb about adding tweet this link to website. Read it here - http://bit.ly/3jF3qy"></a>
<script type="text/javascript">
var twtTitle = document.title;
var twtUrl = location.href;
var maxLength = 140 - (twtUrl.length + 1);
if (twtTitle.length > maxLength) {
twtTitle = twtTitle.substr(0, (maxLength - 3))+'...';
}
var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + twtUrl);
document.write('<a href="'+twtLink+'" target="_blank"'+'><img src="tweetthis.gif" border="0" alt="Tweet This!" /'+'><'+'/a>');
</script>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                