一些JavaScript的社交分享
2013-11-11 11:00
399 查看
http://www.sharethis.com/get-sharing-tools/#
http://www.bshare.cn/
http://www.phpernote.com/javascript-function/333.html
关键性的代码(Javascript):
完整代码:
http://yu123.me/2010/12/sns-share-js/
https://github.com/tmort/Socialite
http://www.hekee.net/ziliao/index.php/facebook-twitter/
http://www.bshare.cn/
http://www.phpernote.com/javascript-function/333.html
关键性的代码(Javascript):
function sharePlugin(name,img,title){ var purl=encodeURIComponent(document.location.href); switch(name){ case 'sina': var url='http://service.t.sina.com.cn/share/share.php?url='+purl+'&appkey=2858164115&title='+encodeURIComponent(""+title)+'&pic='+encodeURIComponent(img)+'&ralateUid=&searchPic=false';//注意这个地方使用了一个appkey,分享到新浪的时候会有一个分享来源,其中的分享来源就取决于这个appkey,你可以根据需要改成自己的appkey window.open(url); break; case 'tqq': var url='http://v.t.qq.com/share/share.php?title='+encodeURIComponent(""+title)+'&url='+purl+'&appkey='+encodeURI("8675d8896e054316bc69755118dea3c9")+'&site='+purl+'&pic='+img; window.open( url,'转播到腾讯微博','width=700,height=680,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,location=yes,resizable=no,status=no' ); break; case 'kaixin': var url='http://www.kaixin001.com/repaste/share.php?rurl='+purl+'&rcontent='+encodeURIComponent(""+title)+'&rtitle='+encodeURIComponent("欣和食与家"); window.open(url); break; case 'renren': var url='http://share.renren.com/share/buttonshare.do?link='+purl+'&title='+encodeURIComponent(""+title); window.open(url); break; case 'douban': var url='http://www.douban.com/recommend/?url='+purl+'&title='+encodeURIComponent(""+title); window.open(url); break; case 'qzone': var url='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(""+title)+'&pics='+img; window.open(url); break; } }
完整代码:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>www.phpernote.com</title> <script language="javascript"> function sharePlugin(name,img,title){var purl=encodeURIComponent(document.location.href);switch(name){case'sina':var url='http://service.t.sina.com.cn/share/share.php?url='+purl+'&appkey=2858164115&title='+encodeURIComponent(""+title)+'&pic='+encodeURIComponent(img)+'&ralateUid=&searchPic=false';window.open(url);break;case'tqq':var url='http://v.t.qq.com/share/share.php?title='+encodeURIComponent(""+title)+'&url='+purl+'&appkey='+encodeURI("8675d8896e054316bc69755118dea3c9")+'&site='+purl+'&pic='+img;window.open(url,'转播到腾讯微博','width=700,height=680,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,location=yes,resizable=no,status=no');break;case'kaixin':var url='http://www.kaixin001.com/repaste/share.php?rurl='+purl+'&rcontent='+encodeURIComponent(""+title)+'&rtitle='+encodeURIComponent("欣和食与家");window.open(url);break;case'renren':var url='http://share.renren.com/share/buttonshare.do?link='+purl+'&title='+encodeURIComponent(""+title);window.open(url);break;case'douban':var url='http://www.douban.com/recommend/?url='+purl+'&title='+encodeURIComponent(""+title);window.open(url);break;case'qzone':var url='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(""+title)+'&pics='+img;window.open(url);break}} </script> </head> <body> <a href="#" onclick="sharePlugin('renren','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到人人网</a> <br /> <a href="#" onclick="sharePlugin('tqq','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到腾讯微博</a> <br /> <a href="#" onclick="sharePlugin('sina','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到新浪微博</a> <br /> <a href="#" onclick="sharePlugin('kaixin','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到开心网</a> </body> </html>
http://yu123.me/2010/12/sns-share-js/
https://github.com/tmort/Socialite
http://www.hekee.net/ziliao/index.php/facebook-twitter/
相关文章推荐
- 分享一些JavaScript简易小技巧
- 分享一些高清javascript书
- 分享一些JavaScript中不足之处
- 一些有用的JavaScript和jQuery的片段分享
- 分享一些javascript与正则表达式常用的调试工具
- 分享一些JavaScript简易小技巧
- 分享自主创业web平台中会员注册过程JavaScript一些应用
- 一些有用的JavaScript和jQuery的片段分享
- 【分享】这些年,我使用的一些工具[非开发类]
- 关于JavaScript的一些知识笔记
- 分享12个效果精美的 JavaScript 倒计时脚本
- 分享一些mysql资料
- 散分+一些跳槽经验分享
- javaScript实用的一些方法
- JavaScript实用的一些技巧
- javaScript中一些常见的兼容性问题整理
- JavaScript关于创建对象和继承的一些总结
- javascript实现修改微信分享的标题内容等
- 国外一些好用的UX/UI设计工具和资源分享
- 分享我学习js的过程 作者aircy javascript学习教程第1/3页