2009-12-05 72 views
0

基本上这里是我的代码,它将共享按钮添加到现有页面。现在我想做的事,是未来添加sharethis按钮(被通过JavaScript调用)的Twitter图片(右侧)如何将sharethis javascript嵌入到另一个JavaScript文件中?

分享的javascript:

<script type="text/javascript"> 
    (function() { 
    function replaceAll(text,strA,strB){while (text.indexOf(strA) != -1) 
    {text = text.replace(strA,strB);} return text;} 
    var share = {"html":"<div class=\"share\" style=\"text-align: left;\">\n\ 
    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t<tr>\n\t\t\t 
    <td colspan=\"16\" style=\"padding: 0px;\">\n\t\t\t\t<h4 style=\"margin-bottom: 
    0px\">Share this with others! <\/h4>\n\t\t\t<\/td>\n\t\t<\/tr>\n\t\t<tr>\n\t\t\t\n\t 
    \t\t<td align=\"center\" style=\"padding: 0px 0px 0px 0px;\"> 
    <a href=\"http:\/\/twitter.com\/home?status=TTIITTLLEE (UURRLL)\" title=\"Click to 
    share this page on Twitter\"><img src=\"http:\/\/img.site.com\/images\/sm\/16 
    \/Twitter%2001.png\" border=\"0\"\/><\/a><\/td>\n\t\t\t<td width=\"0\"> <\/td> 
    \n\t\t<\/tr>\n\t<\/table>\n<\/div>"}; 


     share.html = replaceAll(share.html, "UURRLL", location.href); 
     share.html = replaceAll(share.html, "TTIITTLLEE", document.title); 

     $(function() { 
      $("#question .post-taglist").append("<div style='float:right'>"+share.html+"</div>"); 
     }); 
    })(); 
    </script> 

Sharethis按钮的JavaScript我试图添加:

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=394f24b1-b257-4daf-a92d-334c05a91b58&amp;type=website&amp;buttonText=More%20Services&amp;post_services=email%2Csms%2Caim%2Cmyspace%2Clinkedin%2Cfriendfeed%2Cwordpress%2Cblogger%2Ctypepad%2Cbebo%2Clivejournal%2Cxanga"></script> 

任何人都可以帮我这么做吗?谢谢

你们还可以告诉我新的代码应该去哪里?

回答

1

因为你似乎是已经使用jQuery,只需使用getScript()

+0

似乎无法得到它的工作,应该怎样代码是什么样子? – quil 2009-12-05 21:27:35

相关问题