分享到QQ空間、新浪微博、騰訊微博的程式碼!(收藏)

weixin_34126215發表於2015-02-03

1.QQ空間分享說明
http://connect.qq.com/intro/share/

 

2.

 

QQ空間分享程式碼如下:
 
<a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" title="分享到QQ空間"><img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt="分享到QQ空間" /></a>
新浪微博分享程式碼如下:
 
<script type="text/javascript">document.write('<iframe frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?url=%url%&appkey=&type=3" width="16" height="16"></iframe>'.replace(/%url%/,encodeURIComponent(location.href)));</script>
騰訊微博分享程式碼如下:
 
<a href="javascript:void(0)" onclick="postToWb();" class="tmblog"><img src="http://v.t.qq.com/share/images/s/weiboicon16.png"></a> <script type="text/javascript">
 
function postToWb(){
 
var _t = encodeURI(document.title);
 
var _url = encodeURI(document.location);
 
var _appkey = encodeURI("appkey");//你從騰訊獲得的appkey
 
var _pic = encodeURI('');//(列如:var _pic='圖片url1|圖片url2|圖片url3....)
 
var _site = '';//你的網站地址
 
var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
 
window.open( _u,'轉播到騰訊微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
 
}
 
</script>
QQ朋友社群分享程式碼如下:
 
<a href="javascript:void(0);" 
onclick
="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url='+encodeURIComponent(document.location.href));return false;" title="分享到朋友社群">
<
img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/qzshare/xy-icon.png" alt="分享到朋友社群" /></a> 這裡發個自己DIY的分享程式碼,喜歡的可以拿去用,預覽圖如下 圖片素材在壓縮包裡,程式碼內容如下,儲存為js檔案即可,壓縮包裡也有現成的。 document.writeln("<a href=\"javascript:void((function(s,d,e){try{}catch(e){}var f=\'http:\/\/v.t.sina.com.cn\/share\/share.php?\',u=d.location.href,p=[\'url=\',e(u),\'&title=\',e(d.title),\'&appkey=2924220432\'].join(\'\');function a(){if(!window.open([f,p].join(\'\'),\'mb\',[\'toolbar=0,status=0,resizable=1,width=620,height=450,left=\',(s.width-620)\/2,\',top=\',(s.height-450)\/2].join(\'\')))u.href=[f,p].join(\'\');};if(\/Firefox\/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));\"><img src=\"sina.gif\" \/><\/a>"); document.writeln("<a href=\"javascript:void(0);\" onclick=\"window.open(\'http:\/\/sns.qzone.qq.com\/cgi-bin\/qzshare\/cgi_qzshare_onekey?url=\'+encodeURIComponent(document.location.href));return false;\"><img src=\"qzone.gif\" \/><\/a>"); document.writeln("<a href=\"javascript:void(0)\" onclick=\"postToWb();\"><img src=\"sq.gif\" \/><\/a>"); document.writeln("<script type=\"text\/javascript\">function postToWb(){"); document.writeln("var _t = encodeURI(document.title);"); document.writeln("var _url = encodeURI(document.location);"); document.writeln("var _appkey = encodeURI(\"appkey\");\/\/你從騰訊獲得的appkey"); document.writeln("var _pic = encodeURI(\'\');\/\/(列如:var _pic=\'圖片url1|圖片url2|圖片url3....)"); document.writeln("var _site = \'\';\/\/你的網站地址"); document.writeln("var _u = \'http:\/\/v.t.qq.com\/share\/share.php?title=\'+_t+\'&url=\'+_url+\'&appkey=\'+_appkey+\'&site=\'+_site+\'&pic=\'+_pic;"); document.writeln("window.open( _u,\'轉播到騰訊微博\', \'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no\' );}<\/script>"); document.writeln("<a href=\"javascript:window.open(\'http:\/\/cang.baidu.com\/do\/add?it=\'+encodeURIComponent(document.title.substring(0,76))+\'&iu=\'+encodeURIComponent(location.href)+\'&fr=ien#nw=1\',\'_blank\',\'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\'); void 0\"><img src=\"baidu.gif\" \/><\/a>");

 

 

3.分享到朋友圈

http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url=http%3A%2F%2Fwww.discuz.net%2Fthread-3583254-1-1.html&site=Discuz!%20%E5%AE%98%E6%96%B9%E7%AB%99&title=%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7%E4%B8%8A%E5%BE%AE%E7%A4%BE%E5%8C%BA%E4%B8%8D%E8%83%BD%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87&pics=&from=discuz

4.分享給QQ好友和群組

http://connect.qq.com/widget/shareqq/index.html?url=http%3A%2F%2Fwww.discuz.net%2Fthread-3583254-1-1.html&title=%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7%E4%B8%8A%E5%BE%AE%E7%A4%BE%E5%8C%BA%E4%B8%8D%E8%83%BD%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87&summary=%E4%B8%BB%E8%A6%81%E6%98%AF%E6%89%8B%E6%9C%BA%E7%AB%AF%E4%B8%8D%E8%83%BD%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E3%80%82%E7%82%B9%E5%87%BB%E4%B8%8A%E4%BC%A0%E4%BA%86%E5%B0%B1%E5%8F%88%E8%B7%B3%E5%88%B0%E4%B8%BB%E9%A1%B5%E4%B8%8A%EF%BC%8C%E9%82%A3%E4%B8%AA%E5%A1%AB%E5%85%A5%E5%9B%BE%E7%89%87%E9%93%BE%E6%8E%A5%E7%9A%84%E5%9B%BE%E6%A0%87%E7%82%B9%E5%87%BB%E4%BA%86+...&desc=%E7%9C%8B%E7%9C%8B%E8%BF%99%E4%B8%AA%E5%90%A7%EF%BC%8C%E8%BF%98%E4%B8%8D%E9%94%99%E5%93%A6%EF%BC%8C%E4%B9%9F%E8%AE%B8%E4%BD%A0%E4%BC%9A%E5%96%9C%E6%AC%A2%5E_%5E&site=discuz%7C&style=103&width=50&height=16

 

 

5.微訊號登入

https://open.weixin.qq.com/connect/qrconnect?appid=wxd813c1077086880d&redirect_uri=http%3A%2F%2Fwsq.discuz.qq.com%2F%3Fcmd%3DYz1zaXRlJmE9d3hjYWxsYmFjayZ0eXBlPXFyY29ubmVjdCZzaXRlaWQ9MjQ3NzQyNjc0JnNpdGV1aWQ9MCZxcnJlZmVyZXI9aHR0cCUzQSUyRiUyRnd3dy5kaXNjdXoubmV0JTJGaG9tZS5waHAlM0Ztb2QlM0RzcGFjZSUyNmRvJTNEbm90aWNlJTI2dmlldyUzRGludGVyYWN0aXZlJnR0PTE0Mjc0Njc2ODQmc2lnbmF0dXJlPWRhMjAwMTAzNGNlMzRlMjE4MWVhODJjNTZiOWY2YThkMDAzMjQ4MDE%3D&response_type=code&scope=snsapi_login&state=#wechat_redirect

6.QQ號登入

http://openapi.qzone.qq.com/oauth/qzoneoauth_authorize?oauth_consumer_key=10000034&oauth_token=2873643260663514371

 

相關文章