0

だから私はこの共有ボタンのプラグインを twitter と facebook に使っています。ただし、ボタンを押したときに URL とタイトルを取得するために何を変更すればよいかわかりません。助けてください。

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

4

1 に答える 1

0

window.location.hrefページの URL が表示document.getElementsByTagName("title")され、ページのタイトル要素が表示されます。

それはあなたの質問に答えますか、それともボタンが押された正確な時間にこれらの値を設定しようとしていますか?

于 2013-03-21T20:33:51.900 に答える