网站首页
网站导航
Ctrl+D收藏
首 页
代码段
源码包
文档库
工具箱
代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
JS
】
分享到新浪,人人,开心,天涯,豆瓣,搜狐,腾讯等的代码
作者:
freespider
/ 发布于
2013/12/16
/
280
/** * Copyright (C), 2011-2013 * file name share_ico.js * author:wyl * version:1.0 * date 20110503 * function: Produce button of share icon in the page. example sinaweibo renren kaixin * */ //function ss(){ // // alert('share233223'); //} function shareto(id){ var pic=""; var url=encodeURIComponent(document.location.href); var title=encodeURIComponent(document.title); var _gaq = _gaq ||[]; if(id=="fav"){ addBookmark(document.title); return; }elseif(id=="tqq"){ _gaq.push(['_trackEvent','SocialShare','Share','QZone',1]); window.open(' http://v.t.qq.com/share/share.php?url='+url); return; }elseif(id=="sina"){ _gaq.push(['_trackEvent','SocialShare','Share','SinaT',1]); //window.open(' http://v.t.sina.com.cn/share/share.php?title='+title+'&url='+url+'&source=bookmark','_blank'); window.open(" http://v.t.sina.com.cn/share/share.php?url="+url+"&appkey=3347543801&title="+title+"&pic="+pic,"_blank","width=615,height=505"); return; }elseif(id=="sohu"){ _gaq.push(['_trackEvent','SocialShare','Share','sohu',1]); window.open(' http://t.sohu.com/third/post.jsp?title='+title+'&link='+url+'&fr=ien#nw=1','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); return; }elseif(id=="hexun"){ _gaq.push(['_trackEvent','SocialShare','Share','hexun',1]); window.open('http://bookmark.hexun.com/post.aspx?url='+url+'&title='+title+'&imageurl='+pic,'_blank'); return; }elseif(id=="douban"){ _gaq.push(['_trackEvent','SocialShare','Share','Douban',1]); var d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,s=s1?s1():s2?s2():s3?s3.createRange().text:'',r=' http://www.douban.com/recommend/?url='+e(d.location.href)+'&title='+e(d.title)+'&sel='+e(s)+'&v=1',x=function(){if(!window.open(r,'douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330'))location.href=r+'&r=1'}; if(/Firefox/.test(navigator.userAgent)){setTimeout(x,0)}else{x()} return; }elseif(id=="renren"){ _gaq.push(['_trackEvent','SocialShare','Share','RenRen',1]); window.open(' http://www.connect.renren.com/share/sharer?url='+url+'&title='+title,'_blank','resizable=no'); return; }elseif(id=="kaixin"){ _gaq.push(['_trackEvent','SocialShare','Share','XianGuo',1]); //http://www.kaixin001.com/~repaste/repaste.php?&rurl='+escape(d.location.href)+'&rtitle='+escape(d.title)+'&rcontent='+escape(d.title),'kaixin') window.open(' http://www.kaixin001.com/~repaste/repaste.php?rurl='+url+'&rcontent='+title+'&rtitle='+title,'_blank'); return; }elseif(id=="tianya"){ share2Tianya(document.title,location.href,''); // _gaq.push(['_trackEvent', 'SocialShare', 'Share', 'Mail', 1]); // window.open(' http://t.tianya.cn/?url='+url+'&content='+title+'&title='+title,'_blank'); //window.open(' http://www.tianya.cn/new/share/compose.asp?itemtype=tech&url='+url+'&strTitle='+title,'_blank'); //http://www.tianya.cn/new/share/compose.asp?itemtype=tech&item=665&strTitle=%CC%A8%CD%E5%B0%A2%C0%EF%C9%BD%D0%A1%BB%F0%B3%B5%B7%AD%B3%B5%A3%BA%CA%A5%C2%ED%B6%FB%B6%A8%D2%BD%D4%BA%B2%BF%B7%D6%CD%C5%D4%B1%B3%F6%D4%BA%20%5B%BF%B4%B6%AB%B7%BD%5D&strFlashURL=http://player.youku.com/player.php/sid/XMjYyNDE2NzEy/v.swf&strFlashPageURL=http://v.youku.com/v_show/id_XMjYyNDE2NzEy.html return; } } functionShareButtons(){ document.write('<div class="social_share">'); document.write('<strong>分享到: </strong>'); document.write('<a class="sharebutton" id="share_sina" href="javascript:shareto(\'sina\');" title="分享到新浪微博"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/ico_sina.gif" /></a>'); document.write('<a class="sharebutton" id="share_qzone" href="javascript:shareto(\'tqq\');" title="分享到腾讯微博"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/btn_tqq.png" /></a>'); document.write('<a class="sharebutton" id="share_douban" href="javascript:shareto(\'douban\');" title="分享到豆瓣"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/btn_douban.png"/></a>'); document.write('<a class="sharebutton" id="share_xianguo" href="javascript:shareto(\'kaixin\');" title="分享到开心网"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/btn_kaixin.gif" /></a>'); document.write('<a class="sharebutton" id="share_googlebuzz" href="javascript:shareto(\'hexun\');" title="分享到和讯"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/btn_hexun.gif" /></a>'); document.write('<a class="sharebutton" id="share_baidu" href="javascript:shareto(\'sohu\');" title="分享到搜狐微博"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/ico_sohu.png" /></a>'); document.write('<a class="sharebutton" id="share_renren" href="javascript:shareto(\'renren\');" title="分享到人人网"> <img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/btn_rr.png" /></a>'); document.write('<a class="sharebutton" id="share_mail" href="javascript:shareto(\'tianya\');" title="分享到天涯"><img src="http://wyllife.blog.163.com/blog/./wp-content/themes/rbcpromotion/images/share_icon/ico_tianya.png" /></a>'); document.write('</div>'); } ++++++++++++++++++++++++++++++++++++++++++ 分享到天涯有2种方法,分享到某个板块和分享到微博 具体的请参考 http://open.tianya.cn/Send.php 以下是转帖到某个板块的代码,可以整合到上面的例子里面 <script type="text/javascript" charset="utf-8">(function(){ var param ={ strFlashPageURL:location.href,/**转发帖子原地址*/ strTitle:document.title,/**转发的帖子主题(可选,默认为所在页面的title)*/ strContent:'',/**转发帖子的内容,可以用@添加关联用户(可选)*/ strFlashURL:'',/**转发帖子的视频地址(可选)*/ pIMG:'',/**转发帖子的图片地址(可选)*/ itemtype:'tech', /**转发板块类型*/ item:'402', /**转发板块ID*/ } var temp =[]; for(var p in param ){ temp.push(p +'='+ encodeURIComponent( param[p]||'')) } document.write('<a target="_blank" href="http://www.tianya.cn/new/share/compose.asp?'+ temp.join('&') +'"><img src="http://static.tianyaui.com/global/open/images/shareiconM.gif"></a>') })() </script>
评论列表
本站所提供的代码,版权归原作者所有,若有侵犯作者版权,请与我们联系,我们将立即删除或修改。谢谢!
本站所有代码发布及提供者。
试试其它关键字
同语言下
.
Jquery搜索框获取回车事件
.
H5页面添加倒计时,然后自动跳转
.
通过user-agent判断h5页面是在哪个手机App(QQ、微信
.
nginx 禁止未绑定的域名访问
.
JavaScript 获取按键,并屏蔽系统 Window 事件
.
H5之只允许微信浏览器打开,禁止从外部浏览器访问
.
微信打开网址添加在浏览器中打开提示的办法
.
实现JS复制、粘贴,Chrome/Firefox下可用
.
video视频播放,play()、pause()、duration时长、onen
.
HTML5实现MP3上传前的预览和播放时长的获取
可能有用的
.
Jquery搜索框获取回车事件
.
H5页面添加倒计时,然后自动跳转
.
通过user-agent判断h5页面是在哪个手机App(QQ、微信
.
nginx 禁止未绑定的域名访问
.
JavaScript 获取按键,并屏蔽系统 Window 事件
.
H5之只允许微信浏览器打开,禁止从外部浏览器访问
.
微信打开网址添加在浏览器中打开提示的办法
.
实现JS复制、粘贴,Chrome/Firefox下可用
.
video视频播放,play()、pause()、duration时长、onen
.
HTML5实现MP3上传前的预览和播放时长的获取
freespider
贡献的其它代码
(
22
)
.
javascript控制不同行不同颜色
.
点击外部链接, 让iframe父页面也跟着显示
.
iFrame 自适应高度
.
让文字左右对齐
.
替换函数replace()实现mysql 替换字符串
.
安静删除服务器超级多的文件,有的文件夹文件过多而不
.
css开头的全局标准代码
.
apache 80端口未被占用,启动不了的问题
.
php修改排序,上移下移
.
获取网卡的MAC地址原码;目前支持WIN/LINUX系统 获取
地图
本站
我们
服务
版权
联系
回馈
博客