码迷,mamicode.com
首页 > 其他好文 > 详细

百度分享自定义设置

时间:2015-03-18 17:57:49      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

自定义分享动态内容、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();

 

百度分享自定义设置

标签:

原文地址:http://www.cnblogs.com/q460021417/p/4347749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!