Jayesh Patel
Filed under - jQuery, Other Stuff, Social Media
3 Comments so far. Add yours now

FaceBook & Twitter : using with javascript call function

<script type="text/javascript">
var url_1 = "http://www.obzee.co.kr/obzee/en/front/index.jsp?nolan" ;
function goTwitter(title, link) {
var w = (screen.width-450)/2;
var h = (screen.height-450)/2;
var href = "http://twitter.com/share?text=" + encodeURIComponent(title) + "&url=" + encodeURIComponent(url_1 + link);
var a = window.open(href, 'twitter', 'width=450,height=450,left='+w+',top='+h+',scrollbars=0');
if(a) { a.focus(); }
function pstFaceBook(url,title,summary,image) {
url = url_1 +url;
var d = encodeURIComponent(title);
var image;
image = "&p[images][0]="+image;
image = "";
window.open('http://www.facebook.com/sharer.php?s=100&p[url]=' + encodeURIComponent(url)+"&p[title]="+d+image+"&p[summary]="+summary,"share",'resizable=no width=600 height=400');

<a href="javascript:pstFaceBook('urlName','Name Collection','summary text','image.gif');">facebook</a>
<a href="javascript:goTwitter('Name Collection','urlName');">twitter</a>

<a href=”javascript:pstFaceBook(‘urlName’,'Name Collection’,'summary text’,'image.gif’);”><img src=”btn_facebook.gif” alt=”facebook”></a> &nbsp;
<a href=”javascript:goTwitter(‘Name Collection’,'urlName’);”><img src=”/obzee/en/front/img/common/btn/btn_twitter.gif” alt=”twitter”></a>

3 Responses

  1. Kushal Gandhi on 21 Aug 2012

    Its really good…I will use it in my project..

  2. jignasa on 21 Aug 2012

    Thank you for sharing valuable information, using this code we can share information of our choice on social media rather than the first element on the page.

Leave your comment

You must be logged in to post a comment.

Share IT © 2018. All rights reserved.