查看: 5001|回复: 0
打印 上一主题 下一主题

[网络应用] [转载]整合分享到新浪网易微博代码

[复制链接]

2569

主题

3687

帖子

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
101592
跳转到指定楼层
楼主
发表于 2011-3-2 23:49:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
一、新浪微博分享代码:

   1、各网站、论坛、博客等通用代码:

<a href="javascript:(function(){window.open('http://v.t.sina.com.cn/share/share.php?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href)+'&source=bookmark','_blank','width=450,height=400');})()" title="新浪微博分享"><img src="http://t.sina.com.cn/favicon.ico"  alt="新浪微博分享" border="0">分享到新浪微博</a>

   此代码无需申请 Appkey

    2、新浪官方分享到代码: 

<a href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v.t.sina.com.cn/share/share.php?appkey=真实的appkey',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&cgb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','图片链接|默认为空','标题|默认当前页标题','内容链接|默认当前页location','页面编码gb2312|utf-8默认gb2312'));">分享至微博</a> 

    注意事项说明: 
    此需要申请appkey帐号,地址:open.t.sina.com.cn
    真实的appkey {string} 必选参数 
    图片链接 (String) 可选参数, 默认为空 
    标题 (String) 可选参数, 默认当前页title 
    内容链接 (String) 可选参数, 默认当前页location 
    页面编码 (String) 可选参数, [gb2312|utf-8] 默认gb2312 
    <a> 的链接样式及文字可自行据需求修改.代码中有 " %20f " 属正常代码,无需处理 

    3、非官方正式代码: 

    1)、<a href="http://v.t.sina.com.cn/share/share.php?title=%E4%BD%A0%E5%A5%BD%20hello%20world" target="_blank">分享到微博</a>,简单分享(无需申请) 

    2)、<a href="http://v.t.sina.com.cn/share/share.php?appkey=4120396272&title=%E4%BD%A0%E5%A5%BD%20hello%20world" target="_blank">分享到微博</a>,带有AppKey(Appkey需要前往 open.t.sina.com.cn 申请) 

    字段需要经过encodeURIComponent,例子:
你好 http://t.sina.com.cn/ -&gt <script>document.write(encodeURIComponent("你好 http://t.sina.com.cn/"));</script> 

    注:Appkey需要前往 open.t.sina.com.cn 申请


    二、网易微博分享代码 

    1、样式一:任何网站、博客都可以调用

<a href="javascript:(function(){window.open('http://t.163.com/article/user/checkLogin.do?link=http://news.163.com/&source='+'土豆网'+ '&info='+encodeURIComponent(document.title)+' '+encodeURIComponent(location.href),'_blank','width=510,height=300');})()" title="分享到网易微博"><img src="http://www.taoba123.com/images/resource_10544871274700952v.png" alt="网易微博分享" border="0"></a> 

    2、样式二

<a target="_self" href="javascript:void(0);"><img height="19px" border="0" align="absMiddle" src="http://img1.cache.netease.com/cnews/css09/wblog.gif" alt="分享到网易微博" title="分享到网易微博" />分享到网易微博</a>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


快速回复 返回顶部 返回列表