Tuesday, March 5, 2013

How to add a "Tweet" button to a webpage?

1. HTML
<a href="javascript:poptastic('http://twitter.com/intent/tweet?text=<?php echo $message; ?>&url=<?php echo $url ?>');" title="Share With Twitter">Tweet</a>

2. JS
function poptastic(url) {
      var newWindow = window.open(url, 'name', 'height=600,width=450,top=100,left=500');
      if (window.focus) {
        newWindow.focus();
      }
     
 }

No comments:

Post a Comment