开发者

How can we show facebook share button after page loads?

I am trying to show Facebook share button after the web page is loaded using window.onload function. The code using iframes are working fine for Facebook like button but when I put code for fshare button, its just printed and nothing else happens the code is as follows :

function ImagesocialButtons() {
if (document.getElementById("social_wrap")) {
    var socialCode = "";    
      socialCode += "<div class=\"social_btn\">";   
      socialCode += "<iframe src=\"http://www.facebook.com/plugins/like.php?href="
+ escape(document.URL) + "&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;colorscheme=light&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:90px; height:21px;\" allowTransparency=\开发者_开发知识库"true\"></iframe>"; 
      socialCode += "</div>";   
      socialCode += "<div class=\"social_btn\">";       
      socialCode += "<a name=\"fb_share\" type=\"button_count\" href=\"http://www.facebook.com/sharer.php\">Share</a><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script>";        
      socialCode += "</div>";
    document.getElementById("social_wrap").innerHTML = socialCode;  } }

window.onload = ImagesocialButtons;


I think its not possible. I try something like that but with an ajax pagination, and the "like" button never load again, i think its becase when the code is loaded and needs to be loaded before the page load.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜