2013-03-21 4 views
0

그래서이 공유 버튼 플러그인을 사용하여 트위터와 페이스 북에 사용합니다. 그러나 단추를 누를 때 URL과 제목을 변경하려면 무엇을 변경해야하는지 이해할 수 없습니다. plz 도움.공유 버튼의 콘텐츠 변경

HTML :

<a onclick="Share.facebook('URL','TITLE','IMG_PATH','DESC')"> {sharing is sexy}</a> 
<a onclick="Share.twitter('URL','TITLE')"> {sharing is sexy}</a> 

JS :

Share = { 
    facebook: function(purl, ptitle, pimg, text) { 
     url = 'http://www.facebook.com/sharer.php?s=100'; 
     url += '&p[title]=' + encodeURIComponent(ptitle); 
     url += '&p[summary]=' + encodeURIComponent(text); 
     url += '&p[url]=' + encodeURIComponent(purl); 
     url += '&p[images][0]=' + encodeURIComponent(pimg); 
     Share.popup(url); 
    }, 
    twitter: function(purl, ptitle) { 
     url = 'http://twitter.com/share?'; 
     url += 'text=' + encodeURIComponent(ptitle); 
     url += '&url=' + encodeURIComponent(purl); 
     url += '&counturl=' + encodeURIComponent(purl); 
     Share.popup(url); 
    }, 
    popup: function(url) { 
     window.open(url,'','toolbar=0,status=0,width=626, height=436'); 
    } 
}; 

플러그인은에서 찾을 수 있습니다 http://www.webdesign.org/html-and-css/tutorials/how-to-create-a-share-button-for-your-site.22180.html

답변

0

window.location.href 당신에게 페이지의 URL를 제공하고 document.getElementsByTagName("title") 당신에게 줄 것이다 페이지의 title 요소.

질문에 대한 대답입니까, 아니면 단추를 누른 정확한 시간에이 값을 설정하려고합니까?