·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设问答 >> 分享到新浪微博、QQ书签、豆瓣、百度搜藏等推广功能

分享到新浪微博、QQ书签、豆瓣、百度搜藏等推广功能

作者:佚名      网站建设问答编辑:admin      更新时间:2022-07-23

我们在很多地方看到搜藏到新浪微博、腾讯微博、QQ书签、Google书签等分享推广功能,为了更方便的用这个功能,我将这个功能做成了一个js文件,大家只要在需要显示的地方插入这个js文件就可以了。这个文件主要包含了新浪微博、腾讯微博、QQ书签、Google书签、豆瓣、开心、人人、QQ空间、百度搜藏等几个分享网站。yahoo书签已经停止了这个项目,故没将yahoo书签包含在内。

以下为引用的内容:
// JavaScript Document
document.writeln("<center>我要分享到:<a title=\"新浪微博分享\" href=\"javascript:(function(){window.open('http://v.t.sina.com.cn/share/share.php?title='+encodeURIComponent(document.title)+'&amp;url='+encodeURIComponent(location.href)+'&amp;source=bookmark','_blank','width=450,height=400' );})()\"><img border=\"0\" alt=\"新浪微博分享\" src=\"http://www.mingluxinxi.com/images/logo_sina_t.gif\" />新浪微博</a>");
document.writeln("<a href=\"javascript:void(0)\" _fcksavedurl="\"javascript:void(0)\"" onclick=\"postToWb();\" class=\"tmblog\"><img src=\"
http://www.mingluxinxi.com/images/weiboicon16.png\" border=\"0\">腾讯微博</a>");
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' );}
document.writeln("<a href=\"javascript:window.open(\'http:\/\/www.kaixin001.com\/repaste\/share.php?rtitle=\'+encodeURIComponent(document.title.substring(0,76))+\'&rurl=\'+encodeURIComponent(location.href)+\'&rcontent=<%=description%>\',\'_blank\',\'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\'); _fcksavedurl="\"javascript:window.open(\'http:\/\/www.kaixin001.com\/repaste\/share.php?rtitle=\'+encodeURIComponent(document.title.substring(0,76))+\'&rurl=\'+encodeURIComponent(location.href)+\'&rcontent=<%=description%>\',\'_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.mingluxinxi.com/images/logo_kaixin.gif\" WIDTH=\"16\" HEIGHT=\"16\" BORDER=\"0\" ALT=\"转贴到开心网\">开心<\/a>");


document.writeln("<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),'&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 _fcksavedurl="\"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),'&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" border=0 alt=\"分享到校内人人网\" src=\"
http://www.mingluxinxi.com/images/renren_logo.gif\" width=16 height=16>人人</A>");


document.writeln("<a href=\"javascript:void(0);\" _fcksavedurl="\"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://www.mingluxinxi.com/images/qz_logo.png\" border=\"0\" alt=\"分享到QQ空间\" />QQ空间</a>");


document.writeln("<a href=\"javascript:u=location.href;t=document.title;t=t.substr(0,76);c=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);c=c.substr(0,180);var _fcksavedurl="\"javascript:u=location.href;t=document.title;t=t.substr(0,76);c=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);c=c.substr(0,180);var" url=%22http://cang.baidu.com/do/add?it=%22+encodeURIComponent(t)+%22&amp;iu=%22+encodeURIComponent(u)+%22&amp;dc=%22+encodeURIComponent(c)+%22&amp;fr=ien#nw=1%22;window.open(url,'_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');void 0\" title=\"添加到百度搜藏\"><img width=\"16\" height=\"16\" border=\"0\" alt=\"百度搜藏\" src=\"
http://www.mingluxinxi.com/images/baidu_cang.jpg\" />百度搜藏</a>");


document.writeln("<a href=\"javascript:(function(){var _fcksavedurl="\"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)})();\" title=\"收藏到Google书签\"><img width=\"16\" height=\"16\" border=\"0\" alt=\"Google书签\" src=\"
http://www.mingluxinxi.com/images/12496916883.jpg\" />Google书签</a>");


document.writeln("<a href=\"javascript:var _fcksavedurl="\"javascript:var" u='http://www.douban.com/recommend/?url='+location.href+'&amp;title='+encodeURIComponent(document.title);window.open(u,'douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330' );void(0)\" title=\"推荐给豆瓣友邻\"><img src=\"
http://www.mingluxinxi.com/images/duban_youlin.jpg\" alt=\"\" border=\"0\" />豆瓣</a>");


document.writeln("<a href=\"javascript:window.open('http://shuqian.qq.com/post?from=3&jumpback=2&noui=1&uri='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title),'','width=930,height=570,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)\"><img _fcksavedurl="\"javascript:window.open('http://shuqian.qq.com/post?from=3&jumpback=2&noui=1&uri='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title),'','width=930,height=570,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)\"><img" src=\"
http://www.mingluxinxi.com/images/qq_shuqian.gif\" alt=\"\" border=\"0\" />QQ书签</a>");
document.writeln("</center>");

文章来源:mingluxinxi.com 转载请注明出处链接。