js简单代码分享到QQ空间、新浪微博

分享到QQ空间:

function qqkj(title){
    var p = {  
        url:location.href,  
        showcount:'1',/*是否显示分享总数,显示:'1',不显示:'0' */  
        desc:'这个网站不错分享一下',/*默认分享理由(可选)*/  
        summary:'xx网',/*分享摘要(可选)*/  
        title:title,/*分享标题(可选)*/  
        site:'xx网',/*分享来源 如:腾讯网(可选)*/  
        // 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('&'));  
}

分享到新浪微博:

function weibo(title) {  //3个参数:1要分享的内容,2分享的地址,3appkey
    var txtVal = title;         
    var url = window.location.href;
    window.open("http://v.t.sina.com.cn/share/share.php?appkey=4120396272&title=" + encodeURIComponent(txtVal)+"&url="+encodeURIComponent(url));
}

猜你喜欢

转载自blog.csdn.net/msllws/article/details/80931991