[分享代码]分享到微博等单条链接的分享转发到新浪微博、腾讯微博、搜狐微博、网易微博的JS代码

    来源:站长啦 浏览:1718次 时间:2014-05-26

[分享代码]分享到微博等单条链接的分享转发到新浪微博、腾讯微博、搜狐微博、网易微博的JS代码

雨过天晴工作室有接到一个case把单条网址用分享到微博的代码替换,这里就是我用的代码,收藏 分享下


目前网络流行社会化分享、微博分享转发,相信很多网站主也都在自己的站点或者博客上添加了各种社会化网页分享/分享按钮,以方便访客们收藏分享。现在Free9免费资源网就把“分享转发到新浪微博、腾讯微博、搜狐微博、网易微博的JS代码”分享给需要的站长朋友,希望大家喜欢!

新浪微博分享代码
<a rel="nofollow" href="javascript:void((function(s,d,e){try{}catch(e){}var%20f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(d.title),'&appkey=1392530042'].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='更换成自己的图片地址/images/tsina.gif' alt='分享到新浪微博' border='0'></a>

腾讯微博分享转发代码
<a href="javascript:void(0)" onclick="{ var _t = encodeURI(document.title);  var _url = encodeURI(window.location); var _appkey = '333cf198acc94876a684d043a6b48e14'; var _site = encodeURI; var _pic = ''; 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=580, top=180, left=320, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );  };" ><IMG border=0 alt=转播到腾讯微博 src="更换成自己的图片地址/images/tqq.png" width=16 height=16></a>

搜狐微博分享代码
<a 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'));"><img src='更换成自己的图片地址/images/tsohu.png' title='分享到搜狐微博' border='0'></a>

网易微博分享代码
<script type="text/javascript" charset="utf-8"> (function() { function showKeyShare(){ var param=[],ustr=[]; param[0] = 'key=aNlaHmpG8w7VKvNj'; //转发来源 param[1] = 'url=' + window.location.href; //当前页网址 param[2] = 'togImg=true'; //默认显示转发图片(可选,删除true为不显示) param[3] = 'images='; //images为传过来的图片地址,多个图片地址用","隔开;若为空会自动抓取转发页面图片 url = 'http://api.t.163.com/share?'; url += param.join("&"); ustr[0] = 'height=330,width=550,top=' + (screen.height - 280) / 2 ; ustr[1] = 'left=' + (screen.width - 550) / 2 ; ustr[2] = 'toolbar=no, menubar=no, scrollbars=no,'; ustr[2] += 'resizable=yes,location=no, status=no'; var s=ustr.join(','); window.open(url,'newwindow',s); }; window.showKeyShare=showKeyShare; })(); </script> <a style="display:block;width:16px;height:16px;background-image:url(http://static.t.126.net/frontend/open/image/sprites/key_v111213.png);background-position:0px -210px;background-repeat:no-repeat;" href="javascript:;" onclick="showKeyShare()" > </a> 

当前位置:站长啦网站目录 » 站长资讯 » 站长新闻 » 技术文档 » 文章详细