文章分享代码大集合,希望大家能用上
今天自己在找这些代码,加在自己的几个新优化的企业站上面,想必有很多人和我一样也会用上,就放在这里和大家一起分享下了。现在微博这么红火,在文章的某个地方放上分享到微博,应该很符合大家的需要吧,这样就可以更好的和微博好友分享自己的东西了。
如果你想把文章分享到新浪微博、腾讯微博、人人网、开心网、豆瓣网、QQ空间、网易微博、搜狐微薄等等,下面的代码肯定能帮到你。

首先说分享到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/btn_share.png" alt="分享到QQ空间" /></a>

分享至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/to-py.png" alt="分享到朋友社区" /></a>

转播至腾讯微博通用代码
<a href="javascript:void(0)" onclick="postToWb();" class="tmblog"><img src="http://v.t.qq.com/share/images/s/b24.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>

分享至新浪微博通用代码:
<a href="javascript:(function(){window.open('http://v.t.sina.com.cn/share/share.php?
title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href)
+'&source=bookmark','_blank','width=450,height=400');})()" title="新浪微博分享"><img src="http://timg.sjs.sinajs.cn/t3/style/images/toolbar/s_red.gif" style="margin:0 auto 4px;border:0;vertical-align:middle;"/></a>

分享至搜狐微博通用代码:
<a title="分享到搜狐微博" href="javascript:void((function(s,d,e,r,l,p,t,z,c){var f='http://t.sohu.com/third/post.jsp?',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=660,height=470,left=',(s.width-660)/2,',top=',(s.height-470)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','','','','utf-8'));" style="margin:0 0 0 20px;font-size:12px;font-family:'\5b8b\4f53';color:#369"><span style="display:inline-block;width:16px;height:16px;margin:0 3px 0.2em -20px;vertical-align:middle;background:url(http://s2.cr.itc.cn/img/t/152.png) no-repeat"></span>分享到搜狐微博</a>

分享至网易微博通用代码:
<a target=”_self” onclick=”(function(){var url = ‘link=http://news.163.com/&amp;source=’+ encodeURIComponent(‘网易新闻’)+ ‘&amp;info=’+ encodeURIComponent(document.title) + ‘ ‘ + encodeURIComponent(document.location.href);window.open(‘http://t.163.com/article/user/checkLogin.do?’+url+’&amp;’+new Date().getTime(),’newwindow’,'height=330,width=550,top=’+(screen.height-280)/2+’,left=’+(screen.width-550)/2+’, toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no’);})()” href=”javascript:void(0);”><img height=”19px” border=”0″ align=”absMiddle” src=”http://img1.cache.netease.com/cnews/css09/wblog.gif” alt=”分享到网易微博” title=”分享到网易微博” />分享到网易微博</a>

分享至QQ书签通用代码:
<a href=javascript:window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','');void(0)><img src="更换成自己的图片地址/images/qq.gif" alt="QQ书签" border="0" height="16" width="16"></a>

分享至人人网通用代码:

<a href="javascript:void((function(s,d,e){if(/xiaonei\.com/.test(d.location))return;var%20f='http://share.xiaonei.com/share/buttonshare.do?link=',u=d.location,l=d.title,p=[e(u),'&amp;title=',e(l)].join('');function%20a(){if(!window.open([f,p].join(''),'xnshare',['toolbar=0,status=0,resizable=1,width=626,height=436,left=',(s.width-626)/2,',top=',(s.height-436)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));"><img src="更换成自己的图片地址/images/renren.gif" alt="分享到校内人人网" border="0" height="16" width="16"></a>

分享至开心网网通用代码:

<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(kaixin=window.open('http://www.kaixin001.com/~repaste/repaste.php?&amp;rurl='+escape(d.location.href)+'&amp;rtitle='+escape(d.title)+'&amp;rcontent='+escape(d.title),'kaixin'));kaixin.focus();"><img src="更换成自己的图片地址/images/kaixin001.gif" alt="转贴到开心网" border="0" height="16" width="16"></a>

分享至豆瓣网通用代码:
<a href="javascript:void(function(){var d=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)+'&title='+e(d.title)+'&sel='+e(s)+'&v=1',x=function(){if(!window.open(r,'douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330'))location.href=r+'&r=1'};if(/Firefox/.test(navigator.userAgent)){setTimeout(x,0)}else{x()}})()">豆瓣</a>


以上的代码用户可以根据自己的实际需要稍作修改,如文字连接改为图片连接,或其它的修改……


评论(30) | 引用(0) | 阅读(2716)
星座 Says: Email
2012/02/21 15:18
谢谢楼主的分享。
电吹风什么牌子好 Says: Email Homepage
2012/02/17 00:55
经典之作,学习一下
jfjahp7f Says: Email Homepage
2012/02/16 07:00
There w re? More than enough for Denver Broncos quarterback in polarization was only underdog team to victory over the Pittsburgh Steelers in Sunday's AFC Wild Card game. And Tim Tebow did, thanks to touchdown pass of 80 yards in the first overtime game of the lie watching the Steelers and the world?, Simply stunned.
fehz423y84 Says: Email Homepage
2012/02/14 22:35
The efforts have not been sufficient to prevent a steady decline in searches on Yahoo. The involvement of the company's U.S. search market amounted to around 19 percent when he came Microsoft,Timberland Shoes, according to comScore. Meanwhile, Microsoft has increased its market share of around 9 percent. Eroding the shares of Yahoo search is one of the reasons why their income in the past three years, declining to understand what even a decline in the share price. The company just hired Scott Thompson in the fourth CEO in the last five years been trying for a turnaround at Yahoo.
宁波网络推广 Says: Email Homepage
2012/02/09 10:29
支持楼主
整体橱柜 Says: Email Homepage
2012/02/02 16:07
感谢分享
seo达人 Says:
2012/01/11 16:48
挺漂亮的,不知有没有男朋友
女儿国 Says: Homepage
2012/01/09 13:36
厉害,整理了这么多啊。
蒂芬妮 Says: Email Homepage
2011/12/27 10:48
过来看一下学习了啊
石家庄婚纱礼服 Says: Email Homepage
2011/12/24 13:16
过来看一下来了啊
分页: 1/3 第一页 1 2 3 下页 最后页
发表评论
昵称 [注册]
密码 游客无需密码
网址
电邮
打开HTML 打开UBB 打开表情 隐藏 记住我