github上找到的,合并了一个二维码在线支持API,直接修改样式可用。

二维码API说明网址:http://www.liantu.com/pingtai/

<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="pragma" content="no-cache" />
<title>asdfasdfasdfdsaf</title>
<style>
* {
margin: 0;
padding: 0;
} img {
border: 0 none;
} body {
background: #eee;
} .m-box {
width: 800px;
margin: 0 auto;
padding: 20px;
background: #fff;
} .m-box p {
margin: 0 0 10px;
} .m-box .icn a {
display: block;
width: 55px;
height: 35px;
background: url('http://l.bst.126.net/rsc/img/weibo.png?035') no-repeat;
} .m-box .icn .wb1 {
background-position: 10px -216px;
} .m-box .icn .wb2 {
background-position: -190px -216px;
} .m-box .icn .wb3 {
background: url(http://l.bst.126.net/rsc/img/postshare/tieba24.png) 15px 0 no-repeat;
} .m-box .icn .wb4 {
background-position: -88px -215px;
} .m-box .icn .wb5 {
background-position: -138px -216px;
} .m-box .icn .wb6 {
background-position: -245px -216px;
} .m-box .icn .wb7 {
background-position: -300px -216px;
} .m-box .icn .wb8 {
background-position: -355px -216px;
} .m-box .icn .wb9 {
background-position: -415px -215px;
}
</style>
</head> <body>
<div class="m-box">
<p>分享到微信,易信:</p>
<div class="icn"><img src="http://qr.topscan.com/api.php?text=http://www.baidu.com&w=125" /></div>
</div> <div class="m-box">
<p>分享到新浪微博:</p>
<div class="icn"><a class="wb1" onclick="shareToSinaWB(event)"></a></div>
</div> <div class="m-box">
<p>分享到QQ空间:</p>
<div class="icn"><a class="wb2" onclick="shareToQzone(event)"></a></div>
</div> <div class="m-box">
<p>分享到百度贴吧:</p>
<div class="icn"><a class="wb3" onclick="shareToTieba(event)"></a></div>
</div> <div class="m-box">
<p>分享到豆瓣:</p>
<div class="icn"><a class="wb4" onclick="shareToDouban(event)"></a></div>
</div> <div class="m-box">
<p>分享到腾迅微博:</p>
<div class="icn"><a class="wb5" onclick="shareToQQwb(event)"></a></div>
</div> <div class="m-box">
<p>分享到人人网:</p>
<div class="icn"><a class="wb6" onclick="shareToRenren(event)"></a></div>
</div> <div class="m-box">
<p>分享到开心网:</p>
<div class="icn"><a class="wb7" onclick="shareToKaixin(event)"></a></div>
</div> <div class="m-box">
<p>分享到facebook:</p>
<div class="icn"><a class="wb8" onclick="shareToFacebook(event)"></a></div>
</div>
<div class="m-box">
<p>分享到Twitter:</p>
<div class="icn"><a class="wb9" onclick="shareToTwitter(event)"></a></div>
</div> <script>
var _title, _source, _sourceUrl, _pic, _showcount, _desc="desc", _summary="summary", _site,
_width = 600,
_height = 600,
_top = (screen.height - _height) / 2,
_left = (screen.width - _width) / 2,
_url = 'http://www.baidu.com',
_pic = '';
//分享到新浪微博
function shareToSinaWB(event) {
event.preventDefault();
var _shareUrl = 'http://v.t.sina.com.cn/share/share.php?&appkey=895033136'; //真实的appkey,必选参数
_shareUrl += '&url=' + encodeURIComponent(_url || document.location); //参数url设置分享的内容链接|默认当前页location,可选参数
_shareUrl += '&title=' + encodeURIComponent(_title || document.title); //参数title设置分享的标题|默认当前页标题,可选参数
_shareUrl += '&source=' + encodeURIComponent(_source || '');
_shareUrl += '&sourceUrl=' + encodeURIComponent(_sourceUrl || '');
_shareUrl += '&content=' + 'utf-8'; //参数content设置页面编码gb2312|utf-8,可选参数
_shareUrl += '&pic=' + encodeURIComponent(_pic || ''); //参数pic设置图片链接|默认为空,可选参数
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',top=' + _top + ',left=' + _left + ',toolbar=no,menubar=no,scrollbars=no, resizable=1,location=no,status=0');
}
//分享到QQ空间
function shareToQzone(event) {
event.preventDefault();
var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
_shareUrl += 'url=' + encodeURIComponent(_url || document.location); //参数url设置分享的内容链接|默认当前页location
_shareUrl += '&showcount=' + _showcount || 0; //参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示
_shareUrl += '&desc=' + encodeURIComponent(_desc || '分享的描述'); //参数desc设置分享的描述,可选参数
_shareUrl += '&summary=' + encodeURIComponent(_summary || '分享摘要'); //参数summary设置分享摘要,可选参数
_shareUrl += '&title=' + encodeURIComponent(_title || document.title); //参数title设置分享标题,可选参数
_shareUrl += '&site=' + encodeURIComponent(_site || ''); //参数site设置分享来源,可选参数
_shareUrl += '&pics=' + encodeURIComponent(_pic || ''); //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',top=' + _top + ',left=' + _left + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到百度贴吧
function shareToTieba(event) {
event.preventDefault();
var _shareUrl = 'http://tieba.baidu.com/f/commit/share/openShareApi?';
_shareUrl += 'title=' + encodeURIComponent(_title || document.title); //分享的标题
_shareUrl += '&url=' + encodeURIComponent(_url || document.location); //分享的链接
_shareUrl += '&pic=' + encodeURIComponent(_pic || ''); //分享的图片
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到豆瓣
function shareToDouban(event) {
event.preventDefault();
var _shareUrl = 'http://shuo.douban.com/!service/share?';
_shareUrl += 'href=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&name=' + encodeURIComponent(_title || document.title); //分享的标题
_shareUrl += '&image=' + encodeURIComponent(_pic || ''); //分享的图片
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到腾讯微博
function shareToQQwb(event) {
event.preventDefault();
var _shareUrl = 'http://v.t.qq.com/share/share.php?';
_shareUrl += 'title=' + encodeURIComponent(_title || document.title); //分享的标题
_shareUrl += '&url=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155'; //在腾迅微博平台创建应用获取微博AppKey
_shareUrl += '&site=' + encodeURIComponent(_site || ''); //分享来源
_shareUrl += '&pic=' + encodeURIComponent(_pic || ''); //分享的图片,如果是多张图片,则定义var _pic='图片url1|图片url2|图片url3....'
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到人人网
function shareToRenren(event) {
event.preventDefault();
var _shareUrl = 'http://share.rr.com/share/buttonshare.do?'; //这里的rr是renren,博客园好像和renren有仇
_shareUrl += 'link=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&title=' + encodeURIComponent(_title || document.title); //分享的标题
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到开心网
function shareToKaixin(event) {
event.preventDefault();
var _shareUrl = 'http://www.kaixin001.com/rest/records.php?';
_shareUrl += 'url=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&content=' + encodeURIComponent('分享的文字'); //需要分享的文字,当文字为空时,自动抓取分享网址的title
_shareUrl += '&pic=' + encodeURIComponent(_pic || ''); //分享的图片,多个使用半角逗号分隔
_shareUrl += '&showcount=0'; //是否显示分享数,显示:'1',不显示:'0'
_shareUrl += '&style=11'; //显示的样式,必选参数
_shareUrl += '&aid=' + encodeURIComponent(_site || ''); //显示分享来源
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
function shareToKaixin2(event) {
event.preventDefault();
var _shareUrl = 'http://www.kaixin001.com/repaste/share.php?';
_shareUrl += 'rtitle=' + encodeURIComponent(_title || document.title); //分享的标题
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到facebook
function shareToFacebook(event) {
event.preventDefault();
var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';
_shareUrl += 'u=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&t=' + encodeURIComponent(_title || document.title); //分享的标题
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到facebook
function shareToFacebook(event) {
event.preventDefault();
var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';
_shareUrl += 'u=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&t=' + encodeURIComponent(_title || document.title); //分享的标题
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到Twitter
function shareToTwitter(event) {
event.preventDefault();
var _shareUrl = 'http://twitter.com/intent/tweet?';
_shareUrl += 'url=' + encodeURIComponent(_url || location.href); //分享的链接
_shareUrl += '&text=' + encodeURIComponent(_title || document.title); //分享的标题
window.open(_shareUrl, '_blank', 'width=' + _width + ',height=' + _height + ',left=' + _left + ',top=' + _top + ',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
</script> </body>
</html>

一键分享QQ、微信、微博等的更多相关文章

  1. 分享-QQ/微信/微博(环境搭建)

    QQ环境搭建

  2. 分享到微信微博空间等第三方平台的JS代码

    分享功能有利于传播更多优质的内容,所以在web项目中也是比较常用的.今天就抽空整理下常用的分享平台的JS代码.这些代码可以在对应平台的官方网站上生成,官网上对分享内容的参数也有详尽说明.这里只对常用的 ...

  3. Oauth2.0 QQ&微信&微博实现第三方登陆

    一.写在前面 目前对于大多数的App或Web网站都支持有第三方登陆这个功能,用户可使用 QQ/ 微信/ 微博 帐号快速登录你的网站,降低注册门槛,为你的网站带来海量新用户.最近在新项目上刚好用到了,在 ...

  4. 访问量分类统计(QQ,微信,微博,网页,网站APP,其他)

    刚准备敲键盘,突然想起今天已经星期五了,有点小兴奋,一周又这么愉快的结束,又可以休息了,等等..我好像是来写Java博客的,怎么变成了写日记,好吧,言归正传. 不知道大家有没有遇到过这样的需求:统计一 ...

  5. qq 微信 微博 第三方分享

    <html> <head> <meta charset="utf-8"> <meta name="viewport" ...

  6. App分享之微信微博等各个社交平台的分享授权规则和常见问题

    一.新浪微博分享规则 新浪微博支持分享类型: 应用内分享也就是网页分享支持: 文字,文字+图片,要分享链接需要链接添加在text里分享 客户端分享支持:文字,图片,文字+图片,图片+文字+链接 参数说 ...

  7. Python 第三方登录 实现QQ 微信 微博 登录

    本人写的AgentLogin,能快速返回QQ.微信.微博第三方用户名信息,主要用于快速登录 用 pip命令安装 pip install AgentLogin 用法 : 导入这个包 from Agent ...

  8. TP QQ 微信 微博登录

    use Org\Util\QQconnect; use Org\Util\Wechatauth; use Org\Util\SaeTOAuthV2; use Org\Util\SaeTClientV2 ...

  9. 可实现一键分享到多个平台(微信,微博,qq空间,人人等)

    友推是一款是面向移动应用的SDK分享组件,提供给开发者集成使用.通过友推,开发者可以轻松集成社会化分享功能,同时创建及管理推荐好友使用您应用的推荐奖励活动,用户推荐好友安装使用您的应用即可获得推荐奖励 ...

随机推荐

  1. RestFramework之权限组件

    一.权限组件的使用 1.首先需要导入包 from rest_framework.permissions import BasePermission 2.编写权限类 class VipPermissio ...

  2. 使用框架时,在web.xml中配置servlet时,拦截请求/和/*的区别。

    关于servlet的拦截设置,之前看了好多,说的都不太清除,明白. 最近明白了一些,总的来说就是保证拦截所有用户请求的同时,放行静态资源. 现整理如下: 一.我们都知道在基于Spring的Applic ...

  3. nginx编译安装和功能介绍

    nginx介绍 nginx: engine X,是由1994年毕业于俄罗斯国立莫斯科鲍曼科技大学的同学为俄罗斯rambler.ru公司开发的,开发工作最早从2002年开始,第一次公开发布时间是2004 ...

  4. 【HCIA Gauss】学习汇总-数据库管理(数据库设计 范式 索引 分区)-7

    zsql user/pasword@ip:port -c "show databases" # 展示一条sql语句 spool file_path 指定输出文件 可以为相对路径 s ...

  5. 如何修改配置文件:CentOS下SSH端口修改

    CentOS各发行版中SSH端口默认为22,如果正式做站或其它用途,为了提高安全性就需要修改掉默认的SSH端口号,防止被有心人穷举密码.部分VPS提供商,若您的VPS服务器SSH遭受多次的暴力破解,可 ...

  6. sqlalchemy.exc.CompileError: (in table 'user', column 'username'): VARCHAR requires a length on dialect mysql

    映射数据库时报错:sqlalchemy.exc.CompileError: (in table 'user', column 'username'): VARCHAR requires a lengt ...

  7. querySelector和getElementById方法的区别

    一.querySelector() 的定义 querySelector() 方法选择指定 CSS 选择器的第一个元素 querySelectorAll() 方法选择指定的所有元素 二.与 getEle ...

  8. SVG的几个标签元素

    defs svg允许我们定义以后需要重复使用的图形元素.建议把所有需要再次使用的元素定义在defs元素里面.这样做可以增加svg内容的易读性和可访问性.在defs元素定义的元素不会直接呈现.你可以在你 ...

  9. 前端学习笔记--Visual Studio Code安装及中文显示

    1.在官网https://code.visualstudio.com/下载对应的版本: 2.安装 一路点击下一步,选中  添加到PATH后,安装. 安装成功,可以直接打开使用: 把界面改成中文显示: ...

  10. python_反射——根据字符串获取模块中的属性

    1.获取当前模块中的属性 class Person(object): def __init__(self,name,age): self.name = name self.age = age p = ...