Adding tweeter to ur site


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <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>
  2.  
  3. <script type="text/javascript">
  4. var twtTitle = document.title;
  5. var twtUrl = location.href;
  6. var maxLength = 140 - (twtUrl.length + 1);
  7. if (twtTitle.length > maxLength) {
  8. twtTitle = twtTitle.substr(0, (maxLength - 3))+'...';
  9. }
  10. var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + twtUrl);
  11. document.write('<a href="'+twtLink+'" target="_blank"'+'><img src="tweetthis.gif" border="0" alt="Tweet This!" /'+'><'+'/a>');
  12. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.