【分享到】代码
<div class="share"> <div class="share_share">分享到:</div><div class="share_weibo"><a href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v.t.sina.com.cn/share/share.php?appkey=1486648216',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','','','','gb2312'));">新浪微博</a> </div> <div class="share_baidu"><a href="javascript:u=location.href;t=document.title;c%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);var%20url=%22http://cang.baidu.com/do/add?it=%22+encodeURIComponent(t)+%22&iu=%22+encodeURIComponent(u)+%22&dc=%22+encodeURIComponent(c)+%22&fr=ien#nw=1%22;window.open(url,%22_blank%22,%22scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes%22);%20void%200" >百度收藏</a> </div> <div class="share_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','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)">QQ书签</a> </div> <div class="share_sohubai"><a href="http://bai.sohu.com/share/blank/addbutton.do?from=022v.com&link={$_G['siteurl']}.{$canonical}" target="_blank">白社会</a> </div> <div class="share_tieba"><a href="javascript:;" title="分享到i贴吧" onclick="void(function(){var d=document,e=encodeURIComponent,u='http://tieba.baidu.com/i/app/open_share_api?link='+e(d.location.href),o=function(){if(!window.open(u))location.href=u};if(/Firefox/.test(navigator.userAgent)){setTimeout(o,0)}else{o()};return false;})();">i 贴吧</a> </div> <div class="share_wy"> <a href="javascript:;" onclick="(function(){var url = 'link='+location.href+'&source='+ encodeURIComponent(document.title)+ '&info='+ encodeURIComponent(document.title) + ' ' + encodeURIComponent(document.location.href);window.open('http://t.163.com/article/user/checkLogin.do?'+url+'&'+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');})()"/>网易微博</a> </div> <div class="share_sh"> <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,'','','',document.title,document.location.href,'utf-8'));">搜狐微博</a> </div> <div class="share_bd"> <img src="http://v.t.qq.com/share/images/s/weiboicon16.png" align="absmiddle"/> <a href="javascript:void(0)" onclick="postToWb();" style="height:16px;font-size:12px;line-height:16px;">腾讯微博</a> <script type="text/javascript"> function postToWb(){ var _t = encodeURI(document.title); var _url = encodeURIComponent(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?url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic+'&title='+_t; window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' ); } </script> </div> <div class="share_bd" style="margin-left:10px;padding-top:8px;margin-top:0px;"><img style="margin-left:2px;margin-right:4px;margin-bottom:-4px;" src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/qzshare/xy-icon.png" alt="分享到腾讯朋友" /><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="分享到腾讯朋友">腾讯朋友</a> </div> </div>
样式:
<style>.share { width: 100%; font-size: 12px; overflow:hidden; margin-bottom:10px;}.share_share { height: 13px; margin-right: 5px; padding-top: 11px; float: left; line-height: 12px;}.share_weibo { background-image: url(share_weibo.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 22px; padding-top: 11px; float: left; line-height: 12px;}.share_baidu { background-image: url(share_baidu.jpg); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 19px; padding-top: 11px; float: left; line-height: 12px;}.share_qq { background-image: url(share_qq.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 22px; padding-top: 11px; float: left; line-height: 12px;}.share_360 { background-image: url(share_360.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 22px; padding-top: 11px; float: left; line-height: 12px;}.share_tieba { background-image: url(share_tieba.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 22px; padding-top: 11px; float: left; line-height: 12px;}.share_sohubai{ background-image: url(share_sohu.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-left: 22px; padding-top: 11px; float: left; line-height: 12px;}.share_wy{ background-image: url(share_wy.gif); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-top: 11px; padding-left: 22px; float: left; line-height: 12px;}.share_sh{ background-image: url(share_sh.png); background-repeat: no-repeat; background-position: left bottom; height: 13px; margin-right: 5px; padding-top: 11px; padding-left: 19px; float: left; line-height: 12px; } .share_bd{ height: 14px; float: left; line-height: 14px; padding-top:8px; } </style>