百度分享自定义设置

自定义分享动态内容、QQ空间和人人网摘要、自定义URL地址:

 1 function fx () {

 2                             setTimeout(function  () {

 3                         var oFla = document.getElementById("texta1");

 4                         var texta1=oFla.innerText;

 5                         var oFlb = document.getElementById("texta2");

 6                         var texta2=oFlb.innerText;

 7                         var oUrl = document.getElementById("kzh");

 8                         var a1=oUrl.innerText;

 9                         var oUrl2 = document.getElementById("peizi");

10                         var a2=oUrl2.innerText;

11                         $data = '{"text":"'+texta1+'","desc":"'+texta1+'","url":"'+a1+'"}';

12                         $(".bdshare1").attr("data", $data);

13                         $data = '{"text":"'+texta2+'","desc":"'+texta2+'","url":"'+a2+'"}';

14                         $(".bdshare2").attr("data", $data);

15                         },1000)

16                         }

完整代码:

 1 <!-- Baidu Button BEGIN -->

 2                     <div id="bdshare" class="bdshare_t bds_tools_24 get-codes-bdshare bdshare1">

 3                         <a class="bds_qzone"></a>

 4                         <a class="bds_tsina"></a>

 5                         <a class="bds_tqq"></a>

 6                         <a class="bds_douban"></a>

 7                         <span class="bds_more"></span>

 8                     </div>

 9                     <script type="text/javascript" id="bdshare_js" data="type=tools" ></script>

10                         <script type="text/javascript" id="bdshell_js"></script>

11                         <script type="text/javascript">

12                             document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000);

13                         </script>

14                     <!-- Baidu Button END -->

15 <!-- Baidu Button BEGIN -->

16                 <div id="bdshare" class="bdshare_t bds_tools_24 get-codes-bdshare bdshare2">

17                     <a class="bds_tsina"></a>

18                     <a class="bds_tqq"></a>

19                     <a class="bds_douban"></a>

20                     <a class="bds_qzone"></a>

21                     <span class="bds_more"></span>

22                 </div>

23                 <script type="text/javascript" id="bdshare_js" data="type=tools" ></script>

24                     <script type="text/javascript" id="bdshell_js"></script>

25                 <!-- Baidu Button END -->
 1 //                        百度分享

 2                         function fx () {

 3                             setTimeout(function  () {

 4                         var oFla = document.getElementById("texta1");

 5                         var texta1=oFla.innerText;

 6                         var oFlb = document.getElementById("texta2");

 7                         var texta2=oFlb.innerText;

 8                         var oUrl = document.getElementById("kzh");

 9                         var a1=oUrl.innerText;

10                         var oUrl2 = document.getElementById("peizi");

11                         var a2=oUrl2.innerText;

12                         $data = '{"text":"'+texta1+'","desc":"'+texta1+'","url":"'+a1+'"}';

13                         $(".bdshare1").attr("data", $data);

14                         $data = '{"text":"'+texta2+'","desc":"'+texta2+'","url":"'+a2+'"}';

15                         $(".bdshare2").attr("data", $data);

16                         },1000)

17                         }

18         document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();

 

你可能感兴趣的:(自定义)