admin管理员组文章数量:1530294
转载出处:https://blog.csdn/csdnwangjianxin/article/details/51799235
//分享QQ好友
function qq(title,url,pic)
{
var p = {
url: 'http://test.qicheyitiao',/*获取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/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/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/api.php?text=http://test.qicheyitiao";
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/share/share.php?"+temp.join('&');
window.open(target_url, 'sinaweibo',
'height=430, width=400');
}
记住了QQ分享的的url 如果是localhost是不行的。
版权声明:本文标题:js——分享QQ、QQ空间、微信、微博 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1725786385a1042729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论