织梦模板实现分享到各大网站的功能
我们可以想在dede系统的文章下面加个分享到功能:
比如,把网站内容分享到某些大网站.象百度啊 ,QQ啊.
非常好的功能,可以在不知不觉中增加你的外链,提高你网站的流量。
实际上功能实现起来并不复杂。
下面都是一些可以直接使用的js代码。
只要将这些代码添加到dede模板的相应位置即可。
分享到QQ书签
<a rel="nofollow noopener noreferrer" 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="更换成自己的图片地址/images/qq.gif" alt="QQ书签" border="0" height="16" width="16"></a>
分享到百度收藏。
<a rel="nofollow noopener noreferrer" href="javascript:u=location.href;t=document.title;c = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url=%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); void 0"><img src="更换成自己的图片地址/images/baidu.gif" alt="百度搜藏" border="0" height="16" width="16"></a>
分享到google书签。
<a rel="nofollow noopener noreferrer" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open('http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+c(b.location)+'&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="更换成自己的图片地址/images/google.gif" alt="Google书签" border="0" height="16" width="16"></a>
分享到雅虎收藏
<a rel="nofollow noopener noreferrer" href="#"><img src="更换成自己的图片地址/images/yahoo.gif" alt="雅虎收藏" border="0" height="16" width="16"></a>
分享到校内网
<a rel="nofollow noopener noreferrer" href="javascript:void((function(s,d,e){if(/xiaonei\.com/.test(d.location))return;var%20f='http://share.xiaonei.com/share/butt*****hare.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.rel="nofollow noopener noreferrer" href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));"><img src="更换成自己的图片地址/images/renren.gif" alt="分享到校内人人网" border="0" height="16" width="16"></a>
分享到开心网
<a rel="nofollow noopener noreferrer" 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?&rurl='+escape(d.location.href)+'&rtitle="+escape(d.title)+"&rcontent='+escape(d.title),'kaixin'));kaixin.focus();"><img src="更换成自己的图片地址/images/kaixin001.gif" alt="转贴到开心网" border="0" height="16" width="16"></a>
转帖到服务易
<A title=分享到服务易 rel="nofollow noopener noreferrer" 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.fuwuyi.cn/home.php?mod=spacecp&ac=share&fchannel=xmenus&u='+escape(d.location.href)+'&t='+escape(d.title),'fuwuyi'));fuwuyi.focus();"><IMG alt=转帖到服务易 src="http://www.fuwuyi.cn/favicon.ico" align=absMiddle border=0><FONT color=#996699>服务易</FONT></A>