php分享

来源:互联网 发布:linux版本查看 编辑:程序博客网 时间:2024/04/20 23:10

分享QQ好友和群:

http://connect.qq.com/widget/shareqq/index.html?url=http://blog.csdn.net/wangjinbao5566/article/details/77839101&title=3q&source=3q&desc=3q&pics=3q&summary=3q


js代码如下:

  1. <!DOCTYPE html>  
  2. <html lang="en">  
  3. <head>  
  4.     <meta charset="UTF-8">  
  5.     <title>君乐科技js分享代码</title>  
  6. </head>  
  7. <body style="background:#e5e6e6;">  
  8. <section>  
  9.     <div>  
  10.     <div class="share-box">  
  11.         <div>  
  12.             <p>点击下方图标直接分享</p>         
  13.             <ul>  
  14.                 <!-- 新浪微博 -->  
  15.                 <li><a href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v.t.sina.com.cn/share/share.php?appkey=真实的appkey',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg','君乐科技','http://www.junlenet.com','页面编码gb2312|utf-8默认gb2312'));"  class="invite-kinds2">新浪微博</a></li>  
  16.                 <!-- QQ好友 -->  
  17.                 <li><a href="javascript:;"  id="qq_id" target="_blank">QQ好友</a></li>  
  18.                 <!-- QQ空间 -->  
  19.                 <li><a href="javascript:;"  onclick = "qqZone()">QQ空间</a></li>  
  20.                 <!-- 腾讯微博 -->  
  21.                 <li><a href="javascript:;"  onclick = "tencentWeiBo()">腾讯微博</a></li>  
  22.             </ul>  
  23.         </div>  
  24.         <div class="ewm" id="qrcode"></div>  
  25.         <!-- 参考:jquery.qrcode.js -->  
  26.     </div>  
  27.     </div>  
  28. </section>  
  29. <hr>  
  30. <h3>直接使用百度分享</h3>  
  31. <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a></div>  
  32. <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["weixin","tsina","qzone","tqq"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["weixin","tsina","qzone","tqq"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>  
  33. <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>  
  34. <script>  
  35.   var url = "http://www.junlenet.com";  
  36.     var desc_ = "君乐科技";        
  37.     function tencentWeiBo(){  
  38.          var _url = "http://www.junlenet.com";     
  39.          var _showcount = 0;  
  40.          var _summary = "";  
  41.          var _title = desc_;  
  42.          var _site = "http://www.junlenet.com";    
  43.          var _width = "600px";  
  44.          var _height = "800px";  
  45.          var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";  
  46.          var _shareUrl = 'http://share.v.t.qq.com/index.php?c=share&a=index';  
  47.          _shareUrl += '&title=' + encodeURIComponent(_title||document.title);    //分享的标题  
  48.          _shareUrl += '&url=' + encodeURIComponent(_url||location.href);    //分享的链接  
  49.          _shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155';    //在腾迅微博平台创建应用获取微博AppKey  
  50.          //_shareUrl += '&site=' + encodeURIComponent(_site||'');   //分享来源  
  51.          _shareUrl += '&pic=' + encodeURIComponent(_pic||'');    //分享的图片,如果是多张图片,则定义var _pic='图片url1|图片url2|图片url3....'  
  52.          window.open(_shareUrl,'width='+_width+',height='+_height+',left='+(screen.width-_width)/2+',top='+(screen.height-_height)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');  
  53.     }      
  54.     var top = window.screen.height / 2 - 250;    
  55.     var left = window.screen.width / 2 - 300;    
  56.     var height = window.screen.height;  
  57.     var width =  window.screen.width;   
  58.     /*title是标题,rLink链接,summary内容,site分享来源,pic分享图片路径,分享到新浪微博*/    
  59.     function shareTSina() {    
  60.         var title = desc_;  
  61.         var   rLink = "http://www.junlenet.com";  
  62.         var backUrl = "http://wx.hengfu100.com/member/c_friend";  
  63.         var site = desc_;  
  64.         var pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";  
  65.         window.open("http://service.weibo.com/share/share.php?pic=" +encodeURIComponent(pic) +"&title=" +     
  66.         encodeURIComponent(title.replace(/ /g, " ").replace(/<br \/>/g, " "))+ "&url=" + encodeURIComponent(rLink),    
  67.         "分享至新浪微博",    
  68.         "height=500,width=600,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=noresizable=no,location=nostatus=no");    
  69.     }    
  70.     
  71.      function qqFriend() {  
  72.             var p = {  
  73.                 url : 'http://www.junlenet.com', /*获取URL,可加上来自分享到QQ标识,方便统计*/  
  74.                 desc:'',  
  75.                 //title : '新玩法,再不来你就out了!', /*分享标题(可选)*/  
  76.                 title:desc_,  
  77.                 summary : '', /*分享摘要(可选)*/  
  78.                 pics : 'http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg', /*分享图片(可选)*/  
  79.                 flash : '', /*视频地址(可选)*/  
  80.                 site : 'http://www.junlenet.com', /*分享来源(可选) 如:QQ分享*/  
  81.                 style : '201',  
  82.                 width : 32,  
  83.                 height : 32  
  84.             };  
  85.             var s = [];  
  86.             for ( var i in p) {  
  87.                 s.push(i + '=' + encodeURIComponent(p[i] || ''));  
  88.             }  
  89.             var url = "http://connect.qq.com/widget/shareqq/index.html?"+s.join('&');  
  90.             return url;  
  91.             //window.location.href = url;  
  92.             //document.write(['<a class="qcShareQQDiv" href="http://connect.qq.com/widget/shareqq/index.html?',s.join('&'), '" >分享给QQ好友</a>' ].join(''));  
  93.         }  
  94.       
  95.     function qqZone(){  
  96.          var _url = "http://www.junlenet.com";     
  97.          var _showcount = 0;  
  98.          var _desc = desc_;  
  99.          var _summary = "";  
  100.          var _title = "君乐科技";  
  101.          var _site = "";  
  102.          var _width = "600px";  
  103.          var _height = "800px";  
  104.          var _summary = "";  
  105.          var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg";  
  106.          var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';  
  107.          _shareUrl += 'url=' + encodeURIComponent(_url||document.location);   //参数url设置分享的内容链接|默认当前页location  
  108.          _shareUrl += '&showcount=' + _showcount||0;      //参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示  
  109.          _shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述');    //参数desc设置分享的描述,可选参数  
  110.          //_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要');    //参数summary设置分享摘要,可选参数  
  111.          _shareUrl += '&title=' + encodeURIComponent(_title||document.title);    //参数title设置分享标题,可选参数  
  112.          //_shareUrl += '&site=' + encodeURIComponent(_site||'');   //参数site设置分享来源,可选参数  
  113.          _shareUrl += '&pics=' + encodeURIComponent(_pic||'');   //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数  
  114.         window.open(_shareUrl,'width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');   
  115.     }  
  116.       
  117.      $(function(){     
  118.         var url = qqFriend();  
  119.         $("#qq_id").attr("href",url);      
  120.      })  
  121. </script>  
  122. </body>  
  123. </html> 

原创粉丝点击