2012-09-06 141 views
1

我想弄清楚如何在這個twitter共享功能的開始時輸出文本字符串Try this recipe。所以當你點擊按鈕分享它會說「嘗試這個配方」,然後有網址等。謝謝。附加文本到twitter共享鏈接

function load_twitter() { 
    var load = window.open('http://twitter.com/share?url='+ window.location.href +'&via=atsbyvermouth','','scrollbars=no,menubar=no,height=450,width=650,resizable=yes,toolbar=no,location=no,status=no'); 
} 

回答

1

這很簡單,只要加入這個text=Try this recipe&起初,即

function load_twitter() { 
    window.open('http://twitter.com/share?text=Try this recipe&url='+ window.location.href +'&via=atsbyvermouth','','scrollbars=no,menubar=no,height=450,width=650,resizable=yes,toolbar=no,location=no,status=no'); 
} 

DEMO

+0

謝謝Sheikk它工作得很好!我還不太熟悉Javascript。 – davidz

+0

不客氣,但無論如何,變量'text'在這裏都是get參數。 :-) –