2013-02-20 67 views
0

我爲我的博客變量定製的Tumblr使用了JS按鈕。該按鈕加載一個彈出式窗口,但不是在每個單獨的帖子下出現,而是全部分組在一起。此外,它的輸出:Javascript按鈕無法正確加載

" 

進入Tumblr共享屏幕標題,而不是實際的引號。我怎樣才能點擊彈出窗口的中心?

博客:http://easytestcore.blogspot.com.au/

<script src='http://platform.tumblr.com/v1/share.js'/> 

<span id='tumblr_button_abc123'></span> 
<script type='text/javascript'> 
var strPostUrl = "<data:post.url/>"; 
var strPostTitle = '<data:post.title/>'; 
var tumblr_link_url = strPostUrl.replace("http://",""); 
var tumblr_link_name = strPostTitle.replace(/"/g, '"'); 
</script> 
<script type='text/javascript'> 
var tumblr_button = document.createElement("a"); 
tumblr_button.setAttribute("href", "http://www.tumblr.com/share/link?url=" + encodeURIComponent(tumblr_link_url) + "&name=" + encodeURIComponent(tumblr_link_name)); 
tumblr_button.setAttribute("title", "Share on Tumblr"); 
tumblr_button.setAttribute("style", "display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('http://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;"); 
tumblr_button.innerHTML = "Share on Tumblr"; 
document.getElementById("tumblr_button_abc123").appendChild(tumblr_button); 
</script> 

回答

0

您有多個span用id tumblr_button_abc123,所以當你添加一個按鈕,這個ID,只有第一span拿到按鈕

+0

我理解,但我怎麼能修復? – 2013-02-20 19:05:08