• 设为首页
  • 加入收藏
  • 我要投稿
  • 联系站长
  • 网站模板技术交流
当前位置:模板网首页 > 建站教程 > html教程 >  各大社交网站分享按正文

各大社交网站分享按钮代码

作者:网页模板
类型:文章教程
点击次数:
发布时间:2017-01-03 18:13
分享到:
    各大社交网站分享按钮代码

新浪微博:
http://service.weibo.com/share/share.PHP?url=

count=表示是否显示当前页面被分享数量(1显示)(可选,允许为空)
&url=将页面地址转成短域名,并显示在内容文字后面。(可选,允许为空)
&appkey=用于发布微博的来源显示,为空则分享的内容来源会显示来自互联网。(可选,允许为空)
&title=分享时所示的文字内容,为空则自动抓取分享页面的title值(可选,允许为空)
&pic=自定义图片地址,作为微博配图(可选,允许为空)
&ralateUid=转发时会@相关的微博账号(可选,允许为空)
&language=语言设置(zh_cn|zh_tw)(可选)

我自己写了一个,实现代码如下:

html部分如下:
<span id='aa'>
  <img src="http://t.sina.com.cn/favicon.ico"  alt="新浪微博分享" border="0">分享到新浪微博
 </span>

js部分如下:
var  title = 'AAAA';
  var  url = 'http://www.taobao.com';
  var  pic = 'http://t.sina.com.cn/favicon.ico';
  var href ='http://v.t.sina.com.cn/share/share.php?title='+title+'&url='+url+'&pic='+pic;
  $('#aa').click(function(){
    window.open(href,'_blank')
  })

Facebook分享按钮代码:
<script>function fbs_click() {u=location.href;t=document.title;window.open(‘http://www.facebook.com/sharer.php?u=’+encodeURIComponent(u)+’&t=’+encodeURIComponent(t),’sharer’,'toolbar=0,status=0,width=626,height=436′);return false;}</script><a href=”http://www.facebook.com/share.php?u=<url>” onclick=”return fbs_click()” target=”_blank”><img src=”ADD_IMAGE_URL_HERE” alt=”Share on Facebook” /></a>

Twitter分享按钮代码:
<a href=”http://twitter.com/home?status=Currentlyreading <?php the_permalink(); ?>” title=”Click to share this post on Twitter”"><img src=”ADD_IMAGE_URL_HERE” alt=”Share on Twitter”></a>

1,分享到人人网:
<a class="fav_renren" rel="nofollow" href="JavaScript:window.open('http://share.renren.com/share /buttonshare.do?link='+encodeURIComponent(document.location.href)+'& amp;title='+encodeURIComponent(document.title));void(0)">人人网</a>

2,添加到百度收藏:
<a class="fav_baidu" rel="nofollow" href="javascript:window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title.substring(0,76))+'&amp;iu='+encodeURIComponent(location.href)+'&amp;fr=ien#nw=1','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0">百度搜藏</a>

3,分享到开心网:
<a class="fav_kaixin" rel="nofollow" href="javascript:window.open('http://www.kaixin001.com/repaste /share.php?rtitle='+encodeURIComponent(document.title)+'&amp; rurl='+encodeURIComponent(document.location.href)+'&amp;rcontent='); void(0)">开心网</a>

4,推荐到豆瓣网:
<a class="fav_douban" rel="nofollow" href="javascript:void(function(){var%20d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,s=s1?s1():s2?s2():s3?s3.createRange().text:'',r='http://www.douban.com/recommend/?url='+e(d.location.href)+'&amp;title='+e(d.title)+'&amp;sel='+e(s)+'&amp;v=1',x=function(){if(!window.open(r,'douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330'))location.href=r+'&amp;r=1'};if(/Firefox/.test(navigator.userAgent)){setTimeout(x,0)}else{x()}})()"></a>
或者用这个:
<a class="fav_douban" rel="nofollow" href="javascript:window.open('http://www.douban.com/recommend /?url='+encodeURIComponent(document.location.href)+'&amp; title='+encodeURIComponent(document.title));void(0)">豆瓣</a>

5,添加QQ书签:
<a class="fav_qq" rel="nofollow" href="javascript:window.open('http://shuqian.qq.com/post?from=3&amp; title='+encodeURIComponent(document.title)+'&amp; uri='+encodeURIComponent(document.location.href)+'&amp;jumpback=2& amp;amp;noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes'); void(0)">QQ书签</a>

6,添加到GOOGLE书签:
<a class="fav_google" rel="nofollow" href="javascript:window.open('http://www.google.com/bookmarks/mark?op=add&amp;bkmk='+encodeURIComponent(document.location.href)+'&amp;title='+encodeURIComponent(document.title));void(0)">Google</a>

7,分享到Twitter:
<a class="fav_twitter" rel="nofollow" href="javascript:window.open('http://twitter.com/home?status='+encodeURIComponent(document.location.href)+' '+encodeURIComponent(document.title));void(0)">Twitter</a>

8,分享到Facebook:
<a class="fav_facebook" rel="nofollow" href="javascript:window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(document.location.href)+'&amp;t='+encodeURIComponent(document.title));void(0)">Facebook</a>

9,Delicious书签:
<a class="fav_delicious" rel="nofollow" href="javascript:window.open('http://del.icio.us/post?url='+encodeURIComponent(document.location.href)+'&amp;title='+encodeURIComponent(document.title)+'&amp;notes=');void(0)">Delicious</a>

10.分享到yahoo
<a class="fav_delicious" rel="nofollow" href="javascript:window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+encodeURIComponent(document.location.href)+'&amp;t='+encodeURIComponent(document.title)+'&amp;notes=');void(0)">Yahoo</a>

11.分享到微信朋友圈

一般我们是将这个网页生成二维码,让用户扫码在手机上打开网页。再利用微信右上角本身有的分享到朋友圈以及分享给朋友,聊天组等功能,所以一般我们掌握当前网页自动生成二维码的代码就可以了
<script type="text/javascript">
thisURL = document.URL;
strwrite = "<img src='https://chart.googleapis.com/chart?cht=qr&chs=150x150&choe=UTF-8&chld=L|4&chl="
 +thisURL+"' width='150' height='150' alt='网址URL 二维码生成' />";
document.write( strwrite );
</script>
这里chs=150x150是指生成的二维码内容尺寸;width='150' height='150'指的是二维码图片大小,值越大 空白边框就越大; (责任编辑:网页模板)
  • 本文标签:
  • 各大,社交,网站,分享,按钮,代码,各大,社交,
相关文章推荐
html标签的嵌套规则
没有下一篇