首页 > 代码库 > 一键分享到新浪微博、腾讯微博、搜狐微博、人人网、开心网、百度收藏等js代码大全

一键分享到新浪微博、腾讯微博、搜狐微博、人人网、开心网、百度收藏等js代码大全

下面给大家一些分享的js代码,只要把代码插入自己的网页中稍微修改一下图片路径就可以用了,好了,废话少说,上代码: 

 

document.writeln("<b>喜欢本文,那就分享到:</b>");


document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:window.open(\‘http:\/\/v.t.sina.com.cn\/share\/share.php?title=\‘+encodeURIComponent(document.title.substring(0,76))+\‘&url=\‘+encodeURIComponent(location.href)+\‘&rcontent=\‘,\‘_blank\‘,\‘scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\‘); void 0\" style=\"color:#000000;text-decoration:none;font-size:12px;font-weight:normal\"><img src=http://www.mamicode.com/‘/images/share/sina.jpg‘ alt=‘新浪微博‘ title=‘分享到新浪微博‘ border=‘0‘>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:(function(){window.open(‘http://v.t.qq.com/share /share.php?title=‘+encodeURIComponent(document.title)+‘& url=‘+encodeURIComponent(location.href)+‘& source=bookmark‘,‘_blank‘,‘width=610,height=350‘);})()\" title=\"分享到QQ微博\"><img src=http://www.mamicode.com/‘/images/share/qqwb.png‘ border=‘0‘ alt=‘腾讯微博‘ title=‘分享到腾讯微博‘/>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:d=document;t=d.selection?(d.selection.type!=‘None‘?d.selection.createRange().text:‘‘):(d.getSelection?d.getSelection():‘‘);void(kaixin=window.open(‘http://t.sohu.com/third/post.jsp?&url=‘+escape(d.location.href)+‘&amp;title=‘+escape(d.title)+‘&amp;rcontent=‘+escape(d.title),‘kaixin‘));kaixin.focus();\"><img src=http://www.mamicode.com/‘/images/share/sohu.jpg‘ title=‘分享到搜狐微博‘ alt=‘搜狐微博‘ border=‘0‘ height=‘16‘ width=‘16‘>");

 

document.writeln(" &nbsp;<a href=http://www.mamicode.com/"javascript:u=location.href;t=document.title;c = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url="http:\/\/cang.baidu.com\/do\/add?it="+encodeURIComponent(t)+"&iu="+encodeURIComponent(u)+"&dc="+encodeURIComponent(c)+"&fr=ien#nw=1";window.open(url,"_blank","scrollbars=no,width=440,height=440,left=80,top=80,status=no,resizable=yes"); void 0\"><img src=http://www.mamicode.com/‘/images/share/baidu.gif‘ title=/‘分享到百度搜藏/‘ alt=‘百度收藏‘ border=/‘0/‘>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(‘http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=‘+c(b.location)+‘&amp;title=‘+c(b.title),‘bkmk_popup‘,‘left=‘+((a.screenX||a.screenLeft)+10)+‘,top=‘+((a.screenY||a.screenTop)+10)+‘,height=420px,width=550px,resizable=1,alwaysRaised=1‘);a.setTimeout(function(){d.focus()},300)})();\"><img src=http://www.mamicode.com/‘/images/share/google.png‘ alt=‘Google书签‘ border=‘0‘ title=‘分享到谷歌书签‘ >");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"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.mamicode.com/‘/images/share/kaixin.ico‘ title=‘分享到开心网‘ alt=‘开心网‘ border=‘0‘ height=‘16‘ width=‘16‘>");

 

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:void((function(s,d,e){if(/xiaonei\.com/.test(d.location))return;var f=‘http://share.xiaonei.com/share/buttonshare.do?link=‘,u=d.location,l=d.title,p=[e(u),‘&amp;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=http://www.mamicode.com/[f,p].join(‘‘);};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent));/"><img src=http://www.mamicode.com/‘/images/share/renren.ico‘ alt=‘人人网‘ title=‘分享到人人网‘ border=‘0‘ height=‘16‘ width=‘16‘></a>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:q=(document.location.href);void(open(‘http://www.douban.com/recommend/?url=‘+escape(q),‘‘,‘resizable,location,menubar,toolbar,scrollbars,status‘));\"><img src=http://www.mamicode.com/‘/images/share/douban.jpg‘ border=‘0‘ alt=‘豆瓣网‘ title=‘分享到豆瓣网‘/>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!=‘None‘?document.selection.createRange().text:‘‘):(document.getSelection?document.getSelection():‘‘);void(open(‘http://bookmark.hexun.com/post.aspx?title=‘+escape(t)+‘&url=‘+escape(u)+‘&excerpt=‘+escape(e),‘HexunBookmark‘,‘scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes‘));\"><img src=http://www.mamicode.com/‘/images/share/hexun.gif‘ title=‘分享到和讯网摘‘ border=‘0‘>");

 

document.write(" &nbsp;<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.mamicode.com/"/images/share/qq.gif\" alt=‘QQ书签‘ border=‘0‘></a>  ");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:location.href=http://www.mamicode.com/‘http://myweb.cn.yahoo.com/popadd.html?url=‘+encodeURIComponent(document.location.href)+‘&title=‘+encodeURIComponent(document.title), ‘Yahoo‘,‘scrollbars=yes,width=440,height=440,left=80,top=80,status=yes,resizable=yes‘;\" target=‘_blank‘><img src=http://www.mamicode.com/‘/images/share/yahoo.gif‘ alt=‘雅虎收藏‘ title=‘分享到雅虎收藏‘ border=‘0‘ > ");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:location.href=http://www.mamicode.com/‘http://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=‘+encodeURIComponent(location.href)+‘&title=‘+encodeURIComponent(document.title)\" target=‘_blank‘><img src=http://www.mamicode.com/"/images/share/live.gif\" alt=\"Live Bookmark\" title=\"分享到Live Bookmark\" border=\"0\"/></a>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:d=document;t=d.selection?(d.selection.type!=‘None‘?d.selection.createRange().text:‘‘):(d.getSelection?d.getSelection():‘‘);void(vivi=window.open(‘http://vivi.sina.com.cn/collect/icollect.php?pid=28&title=‘+escape(d.title)+‘&url=‘+escape(d.location.href)+‘&desc=‘+escape(t),‘vivi‘,‘scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes‘));vivi.focus();\"><img src=http://www.mamicode.com/‘/images/share/vivi.gif‘ title=‘分享到新浪ViVi‘ border=‘0‘>");

 

document.write(" &nbsp;<a href=http://www.mamicode.com/"javascript:q=(document.location.href);void(open(‘http://www.digbuzz.com/submit.php?url=‘+escape(q),‘‘,‘resizable,location,menubar,toolbar,scrollbars,status‘));\"><img src=http://www.mamicode.com/‘/images/share/digbuzz.gif‘ border=‘0‘ alt=‘Digbuzz我挖网‘ title=‘分享到Digbuzz我挖网‘/>");