分享到QQ空间、新浪微博、腾讯微博的代码
今天公司原来的分享代码,在IE下有问题。网上找了下网上的分享代码。
给网页加上分享代码,借助网友的力量推广网站,目前已经很流行了
以下是网页代码
QQ空间分享代码如下:
<a href="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://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt="分享到QQ空间" /></a>
新浪微博分享代码如下:
<script type="text/javascript">document.write('<iframe frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?url=%url%&appkey=&type=3" width="16" height="16"></iframe>'.replace(/%url%/,encodeURIComponent(location.href)));</script>
腾讯微博分享代码如下:
<a href="javascript:void(0)" onclick="postToWb();" class="tmblog"><img src="http://v.t.qq.com/share/images/s/weiboicon16.png"></a> <script type="text/javascript">
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' );
}
</script>
QQ朋友社区分享代码如下:
<a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url='+encodeURIComponent(document.location.href));return false;" title="分享到朋友社区"><img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/qzshare/xy-icon.png" alt="分享到朋友社区" /></a>
这里发个自己DIY的分享代码,喜欢的可以拿去用,预览图如下
图片素材在压缩包里,代码内容如下,保存为js文件即可,压缩包里也有现成的。
document.writeln("<a href=\"javascript:void((function(s,d,e){try{}catch(e){}var f=\'http:\/\/v.t.sina.com.cn\/share\/share.php?\',u=d.location.href,p=[\'url=\',e(u),\'&title=\',e(d.title),\'&appkey=2924220432\'].join(\'\');function a(){if(!window.open([f,p].join(\'\'),\'mb\',[\'toolbar=0,status=0,resizable=1,width=620,height=450,left=\',(s.width-620)\/2,\',top=\',(s.height-450)\/2].join(\'\')))u.href=[f,p].join(\'\');};if(\/Firefox\/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));\"><img src=\"sina.gif\" \/><\/a>");
document.writeln("<a href=\"javascript:void(0);\" onclick=\"window.open(\'http:\/\/sns.qzone.qq.com\/cgi-bin\/qzshare\/cgi_qzshare_onekey?url=\'+encodeURIComponent(document.location.href));return false;\"><img src=\"qzone.gif\" \/><\/a>");
document.writeln("<a href=\"javascript:void(0)\" onclick=\"postToWb();\"><img src=\"sq.gif\" \/><\/a>");
document.writeln("<script type=\"text\/javascript\">function postToWb(){");
document.writeln("var _t = encodeURI(document.title);");
document.writeln("var _url = encodeURI(document.location);");
document.writeln("var _appkey = encodeURI(\"appkey\");\/\/你从腾讯获得的appkey");
document.writeln("var _pic = encodeURI(\'\');\/\/(列如:var _pic=\'图片url1|图片url2|图片url3....)");
document.writeln("var _site = \'\';\/\/你的网站地址");
document.writeln("var _u = \'http:\/\/v.t.qq.com\/share\/share.php?title=\'+_t+\'&url=\'+_url+\'&appkey=\'+_appkey+\'&site=\'+_site+\'&pic=\'+_pic;");
document.writeln("window.open( _u,\'转播到腾讯微博\', \'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no\' );}<\/script>");
document.writeln("<a href=\"javascript:window.open(\'http:\/\/cang.baidu.com\/do\/add?it=\'+encodeURIComponent(document.title.substring(0,76))+\'&iu=\'+encodeURIComponent(location.href)+\'&fr=ien#nw=1\',\'_blank\',\'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\'); void 0\"><img src=\"baidu.gif\" \/><\/a>");
源文地址:
http://hi.baidu.com/bingxianan/item/de183efd87d29c7e3c198bae
分享到QQ空间、新浪微博、腾讯微博的代码的更多相关文章
- php 实现分享到QQ空间 新浪微博
//分享到新浪微博 $('#blog').click(function(){ window.sharetitle = '<%$info.title%>';//标题 window.share ...
- 如何将自己的网站分享到QQ空间,微信,微博等等。
逛一些网站的时候经常会看到右侧挂个分享栏,让用户把自己的站分享到qq空间,微信等等,所以自己也研究了下,把他加到了自己的网站上,喜欢的可以先看看效果:去转盘网,不多说了,直接上代码: window._ ...
- 分享到QQ空间、新浪微博、腾讯微博的代码!(收藏)
QQ空间分享代码如下: <a href="javascript:void(0);" onclick="window.open('http://sns.qzon ...
- 分享到QQ空间、新浪微博、腾讯微博的代码!
给网页加上分享代码,借助网友的力量推广网站,目前已经很流行了 以下是网页代码 QQ空间分享代码如下: <a href="javascript:void(0);" onclic ...
- 一键分享代码(提供能分享到QQ空间、新浪微博、人人网等的分享功能)
<html> <head></head> <body> <div class="xl_2"> <span styl ...
- 实现分享功能(分享到qq空间,新浪微博)
//分享QQ好友 function qq(title,url,pic) { var p = { url: 'http://test.qichey ...
- js 分享QQ、QQ空间、微信、微博
//分享QQ好友 function qq(title,url,pic) { var p = { url: 'http://test.qicheyitiao.com',/*获取URL,可加上来自分享到Q ...
- 分享到QQ空间和新浪微博功能
分享到QQ空间 http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=http://campus.51job.com/cmbnt ...
- 一键分享到QQ空间、QQ好友、新浪微博、微信代码
通过qq空间.qq聊天.新浪微博和微信二维码分享平台提供的接口,实现把网页中对应的图片.标题.描述的信息参数用javascript获取后传进接口中,实现一键分享. 使用到的接口(测试时需要登录,网址和 ...
随机推荐
- 二叉查找树(一)之 图文解析 和 C语言的实现
概要 本章先对二叉树的相关理论知识进行介绍,然后给出C语言的详细实现.关于二叉树的学习,需要说明的是:它并不难,不仅不难,而且它非常简单.初次接触树的时候,我也觉得它似乎很难:而之所产生这种感觉主要是 ...
- 受限玻尔兹曼机(RBM)学习笔记(八)RBM 的评估
去年 6 月份写的博文<Yusuke Sugomori 的 C 语言 Deep Learning 程序解读>是囫囵吞枣地读完一个关于 DBN 算法的开源代码后的笔记,当时对其中涉及的算 ...
- Android 学习笔记之SurfaceView的使用+如何实现视频播放...
学习内容: 1.掌握Surface的使用... 2.Android中如何实现视频播放... 1.SurfaceView类的使用 在Android中,一般播放音频时我们可以去使用Android提供的 ...
- flex布局浅谈和实例
阿基米德曾说给我一个支点我可以撬动地球,而拥有flex基本可以撬动所有的布局. 1.flex布局基本介绍及效果展示 工欲善其事必先利其器,来来来,一起看下基础知识先(呵~,老掉牙,但是有用啊). ** ...
- codevs4247奇特的生物 解析报告
4247 奇特的生物 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 题目描述 Description 科学家们最近发现了一种奇怪的生物,它们每天长大一岁 ...
- Ubuntu系统操作快捷键
Ubuntu操作基本快捷键* 打开主菜单 = Alt + F1* 运行 = Alt + F2* 显示桌面 = Ctrl + Alt + d* 最小化当前窗口 = Alt + F9* 最大化当前窗口 = ...
- 新学C#线程使用总结
这两天在项目上需要使用多线程技术,研究了半天,碰到了一些问题,现在简要总结下. 线程的使用其实很简单,和JAVA里面差不多,但是还是有很多特别的地方,在C#中的线程,如果要对非线程创建的控件进行操作的 ...
- .net reflector激活
1.断网 2. 运行.NET Reflector,点击Help -> Activate 3. 运行注册机,复制注册机生成的序列号,粘贴到.NET Reflector中的激活输入框 4. 点击激活 ...
- C#初入串口通信(串行通信)总结
使用WinFrom来实现: 首先要知道串口通信协议以及原理 原理大概提一下:要自己翻阅看.(http://book.51cto.com/art/200911/162532.htm或者http://hi ...
- javascript: jquery.gomap-1.3.3.js
from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...