通过JavaScript打开网页方式进行分享-转最简单易用的开心网、人人网、新浪微博、腾讯微博、QQ空间分享代码

在站里添加分享到各大平台功能,借助网友们的力量推广自己站,已经变得非常流行了,对seo们来说这是这个需要注意的细节。。

以下是一部分网页分享代码:

分享到开心网代码:
<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="http://www.ecshop120.com/images/toshare/ico_kaixin.gif" alt="转贴到开心网"   border="0" height="16" width="16"></a> 

分享到人人网代码:
<a href="javascript:void((function(s,d,e){if(/renren\.com/.test(d.location))return;var f='http://share.renren.com/share/buttonshare?link=',u=d.location,l=d.title,p=[e(u),'&title=',e(l)].join('');function a(){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 a();})(screen,document,encodeURIComponent));" title="分享到人人"><img src="http://www.ecshop120.com/images/toshare/ico_renren.gif" alt="分享到人人" title="分享到人人"/></a> 

分享到新浪微博代码:
<a href="javascript: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');void(0)"><img src='http://www.ecshop120.com/images/toshare/ico_sina.gif' alt='分享到新浪微博' title="分享到新浪微博" border='0'></a>
 
分享到腾讯微博代码:
<a href="javascript:void(0)" onclick="postToWb();" class="tmblog"><img   alt="分享到腾讯微博" title="分享到腾讯微博"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 = 'http://www.hqfo.com.cn';//你的网站地址 
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?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空间"   title="分享到QQ空间"/></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="http://www.ecshop120.com/images/toshare/ico_qqshuqian.gif" alt="QQ书签" title="QQ书签" border="0" ></a> 

分享到百度搜藏代码:
<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 alt="添加到百度搜藏" title="添加到百度搜藏" src="http://www.ecshop120.com/images/toshare/ico_soucang.gif"   border=0></a> 

        以上几种特此推荐   腾讯微博是会被百度抓取的哦!!

转载地址:http://blog.sina.com.cn/s/blog_7952fef80100wn0f.html

你可能感兴趣的:(通过JavaScript打开网页方式进行分享-转最简单易用的开心网、人人网、新浪微博、腾讯微博、QQ空间分享代码)