分享到微信、微博、QQ空间、QQ微博

一:分享到微信

//分享到微信
$("#weixin").bind("click", function () {
    var p = {
        url: url,
        title: title
    };
    var s = [];
    for (var i in p) {
        s.push(i + '=' + encodeURIComponent(p[i] || ''));
    }
    if (content) {
        window.open('/CourseLearning/Share_Weixin?' + s.join('&'), '_login');
    }
});

 

二:QQ空间
var QZone = function (url, content, pics, title) {
    var p = {
        url: url,
        showcount: '1',/*是否显示分享总数,显示:'1',不显示:'0' */
        desc: '',/*默认分享理由(可选)*/
        summary: content,/*分享摘要(可选)*/
        title: title,/*分享标题(可选)*/
        site: '',/*分享来源 如:腾讯网(可选)*/
        pics: pics, /*分享图片的路径(可选)*/
        style: '203',
        width: 98,
        height: 22
    };

    var s = [];
    for (var i in p) {
        s.push(i + '=' + encodeURIComponent(p[i] || ''));
    }

    if (content) {
        window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?" + s.join('&'));
    }
};

 

三:分享新浪微博
var TSina = function (url, content, pic) {
    var p = {
        url: url,
        appkey: "",
        type: 3,
        title: content,/*分享标题(可选)*/
        pic: pic /*分享图片的路径(可选)*/
    };

    var s = [];
    for (var i in p) {
        s.push(i + '=' + encodeURIComponent(p[i] || ''));
    }

    if (content) {
        window.open('http://v.t.sina.com.cn/share/share.php?' + s.join('&'));
    }
};

 

四:分享qq微博
var TQq = function (url, content, pic) {
    var p = {
        url: url,
        appkey: "",
        title: content,/*分享标题(可选)*/
        pic: pic, /*分享图片的路径(可选)*/
        site: ''
    };

    var s = [];
    for (var i in p) {
        s.push(i + '=' + encodeURIComponent(p[i] || ''));
    }

    if (content) {
        window.open('http://v.t.qq.com/share/share.php?' + s.join('&'));
    }
};

posted @ 2015-06-07 15:48  陆敏技  阅读(972)  评论(2编辑  收藏  举报
Web Counter
Coupon for Contacts