手机版 | 登陆 | 注册 | 留言 | 设首页 | 加收藏
当前位置: 网站首页 > 电脑知识 > 文章 当前位置: 电脑知识 > 文章

介绍几种“分享到”代码的实现方式

时间:2011-03-24    点击: 次    来源:网络    作者:不详 - 小 + 大

我们经常在各大网站发现“分享到”代码,非常方便实用,这里我们简单介绍几种实现方法。

方法一:自己做分享到代码,模板如下

<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="更换成自己的图片地址/images/qq.gif" alt="QQ书签" border="0" height="16" width="16"></a>

<a 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>

<a href="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="更换成自己的图片地址/images/google.gif" alt="Google书签" border="0" height="16" width="16"></a>

<a href="#" onclick="window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title), 'Yahoo','scrollbars=yes,width=780,height=550,left=80,top=80,status=yes,resizable=yes');"><img src="更换成自己的图片地址/images/yahoo.gif" alt="雅虎收藏" border="0" height="16" width="16"></a>

<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),'&amp;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 src="更换成自己的图片地址/images/renren.gif" alt="分享到校内人人网" border="0" height="16" width="16"></a>

<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="更换成自己的图片地址/images/kaixin001.gif" alt="转贴到开心网" border="0" height="16" width="16"></a>

<A title=分享到服务易 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&amp;ac=share&amp;fchannel=xmenus&amp;u='+escape(d.location.href)+'&amp;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>


方法二:利用网络上其他网站提供的现成代码,获取后将其嵌入到指定位置即可。

上一篇:瑞星宣布杀毒软件永久免费

下一篇:httpd.ini重写教程

凯立德2019冬季版更新..
粤ICP备13076123号  |   QQ:4805346  |  地址:Com  |  电话:92777708  |  
Copyright © 2024 天人文章管理系统 版权所有,授权Www.Qtxw.Com使用 Powered by 55TR.COM