文章页 第三方分享 js

三种方式:
第一种:http://www.bshare.cn/  参考bshare官网


第二种:
<script>
//分享到新浪微博 
            $('#blog').click(function(){ 
                window.sharetitle ='<%$info.title%>';//标题 
                window.shareUrl ='__IMG__<%$info.img.0.url%>';//缩略图 
                share(); 
            }); 
            function share(){ 
                //d指的是window 
                (function(s,d,e){try{}catch(e){}var f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(window.sharetitle),'&appkey=2924220432','&pic=',e(window.shareUrl)].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent); 
            } 




//分享到QQ空间 
            $("#zone").click(function(){ 
                var p = { 
                    url:location.href, 
                    showcount:'1',/*是否显示分享总数,显示:'1',不显示:'0' */ 
                    desc:'',/*默认分享理由(可选)*/ 
                    summary:'',/*分享摘要(可选)*/ 
                    title:'',/*分享标题(可选)*/ 
                    site:'空间家',/*分享来源 如:腾讯网(可选)*/ 
                    pics:'',/*分享图片的路径(可选)*/ 
                    style:'203', 
                    width:98, 
                    height:22 
                }; 
                var s = []; 
                for(var i in p){ 
                    s.push(i +'=' + encodeURIComponent(p[i]||'')); 
                } 
                window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"+s.join('&')); 
            });

 </script>



第三种:
 <script>

                //分享QQ好友
    function qq(title,url,pic)
    {
        var p = {
            url: 'http://test.qicheyitiao.com',/*获取URL,可加上来自分享到QQ标识,方便统计*/
            desc: '来自汽车氪的分享', /*分享理由(风格应模拟用户对话),支持多分享语随机展现(使用|分隔)*/
            title : title,/*分享标题(可选)*/
            summary : title,/*分享描述(可选)*/
            pics : pic,/*分享图片(可选)*/
            flash : '', /*视频地址(可选)*/
            //commonClient : true, /*客户端嵌入标志*/
            site: '汽车氪'/*分享来源 (可选) ,如:QQ分享*/
        };


        var s = [];
        for (var i in p) {
            s.push(i + '=' + encodeURIComponent(p[i] || ''));
        }
        var target_url = "http://connect.qq.com/widget/shareqq/iframe_index.html?" + s.join('&') ;
        window.open(target_url, 'qq',
                'height=520, width=720');
    }

 

 //分享到QQ空间
    function qZone(title,pic){
            var p = {
                url: '',
                showcount: '1',/*是否显示分享总数,显示:'1',不显示:'0' */
                desc: '这篇文章不错,分享一下~~',/*默认分享理由(可选)*/
                summary: '',/*分享摘要(可选)*/
                title: title,/*分享标题(可选)*/
                site: '汽车氪',/*分享来源 如:腾讯网(可选)summary*/
                pics: pic, /*分享图片的路径(可选)*/
                style: '101',
                width: 199,
                height: 30
            };
            var s = [];
            for (var i in p) {
                s.push(i + '=' + encodeURIComponent(p[i] || ''));
            }
        var target_url =
                "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"+s.join('&');
        window.open(target_url, 'qZone',
                'height=430, width=400');
    }

//微信分享

function weixin(){
        var target_url =
                "http://qr.liantu.com/api.php?text=http://test.qicheyitiao.com";
        window.open(target_url, 'weixin',
                'height=320, width=320');
    }

 //    分享新浪微博
    function sinaWeiBo(title,url,pic){
        var
                param = {
                    url:url,
            type:'3',
            count:'1', /** 是否显示分享数,1显示(可选)*/
            appkey:'汽车氪', /** 您申请的应用appkey,显示分享来源(可选)*/
            title:title, /** 分享的文字内容(可选,默认为所在页面的title)*/
            pic:pic, /**分享图片的路径(可选)*/ ralateUid:'', /**关联用户的UID,分享微博会@该用户(可选)*/
            rnd:new Date().valueOf()
        }
        var temp = [];
        for( var p in param ){
            temp.push(p + '=' +encodeURIComponent( param[p ] || '' ) )
        }
        var target_url =
                "http://service.weibo.com/share/share.php?"+temp.join('&');
        window.open(target_url, 'sinaweibo',
                'height=430, width=400');
    }
            </script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值