调用简单分享功能QQ豆瓣微博

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>

<body>

    <div class="share_top_style">
        <a href="javascript:void()" class="" onClick="dofristshare('sina')"><img src="images/sina.png" alt="新浪微博"></a>

        <a href="javascript:void()" class="" onClick="dofristshare('tx')"><img src="images/tx.png" alt="腾讯微博"></a>

        <a href="javascript:void()" class="" onClick="dofristshare('rr')"><img src="images/rr.png" alt="人人网"></a>

        <a href="javascript:void()" class="" onClick="dofristshare('qzone')"><img src="images/qq.png" alt="QQ空间"></a>

        <a href="javascript:void()" class="" onClick="dofristshare('douban')"><img src="images/db.png" alt="豆瓣"></a>
    </div>


    <script type="text/javascript">
        function dofristshare(type) {
            var title = encodeURIComponent("新年快乐,马年吉祥");
            var link = encodeURIComponent('http://www.baidu.com');
            var image = encodeURIComponent('http://www.baidu.com/img/bdlogo.gif');

            if (type == "sina") {
                window.open("http://v.t.sina.com.cn/share/share.php?url=" + link + "&title=" + title +
                    "&content=utf8&pic=" + image);
            }

            if (type == "tx") {
                window.open("http://v.t.qq.com/share/share.php?url=" + link + "&title=" + title + "&pic=" + image);
            }

            if (type == "qzone") {
                window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=" + link + "&title=" +
                    title + "&pics=" + image);
            }

            if (type == "rr") {
                window.open("http://widget.renren.com/dialog/share?resourceUrl=" + link + "&title=" + title + "&pic=" +
                    image);
            }

            if (type == "douban") {
                window.open("http://www.douban.com/recommend/?url=" + link + "&title=" + title + "&image=" + image);
            }

            return false;

        }
    </script>
</body>

 

转载于:https://www.cnblogs.com/shiyiaaa/p/11309650.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值