简易一键分享到QQ空间

html 代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button style="font-size:24px;" id="btn">分享到QQ空间</button>

<script>
    var ShareTip = function () {

    }
    //分享到腾讯微博
    ShareTip.prototype.sharetoqq = function (content, url, picurl) {
        var shareqqstring = 'http://v.t.qq.com/share/share.php?title=' + content + '&url=' + url + '&pic=' + picurl;
        window.open(shareqqstring, 'newwindow', 'height=500,width=600,top=100,left=100');
    }
    //分享到新浪微博
    ShareTip.prototype.sharetosina = function (title, url, picurl) {
        var sharesinastring = 'http://v.t.sina.com.cn/share/share.php?title=' + title + '&url=' + url + '&content=utf-8&sourceUrl=' + url + '&pic=' + picurl;
        window.open(sharesinastring, 'newwindow', 'height=400,width=400,top=100,left=100');
    }
    //分享到QQ空间
    ShareTip.prototype.sharetoqqzone = function (title, url, picurl) {
        var shareqqzonestring = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?summary=' + title + '&url=' + url + '&pics=' + picurl;
        window.open(shareqqzonestring, 'newwindow', 'height=400,width=400,top=100,left=100');
    }

    var share = new ShareTip();
    document.getElementById('btn').onclick = function () {
        share.sharetoqqzone("这是一本关于地图故事的集锦,以一本书的形式来展示地图故事,我们可以使用鼠标拖动来翻页,或者点击翻页按钮,点击 马上体验,可以体验故事,同时在触屏上也有很好的体验效果奥,地图故事,尽在书中,赶快体验吧,建议使用对 HTML5支持较好的浏览器", "http://tm.arcgisonline.cn:8038/App101/MapstoryBook/Default.html", "http://tm.arcgisonline.cn:8038/App101/MapstoryBook/css/Img/ShareBook.jpg");
    };
</script>
</body>
</html>

当然还有一个更好用的分享工具 BShare
BShare
html 代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div class="bshare-custom">
        <a title="分享到QQ空间" class="bshare-qzone"></a>
        <a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
        <a title="分享到人人网" class="bshare-renren"></a>
        <a title="分享到腾讯微博" class="bshare-qqmb"></a>
        <a title="分享到网易微博" class="bshare-neteasemb"></a>
        <a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
        <span class="BSHARE_COUNT bshare-share-count">0</span>
    </div>
    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=3&amp;lang=zh"></script>
    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值