我们阅读博客的时候经常会用到这样功能,当然有时候也会想把自己的网站上也加入类似的分享功能,各大厂商已经给出了相应的API,点击一个按钮即可弹出窗口进入分享,我们事先可以设置一些参数,一般常用的就是 网站的网址,图片还有一些内容描述。这里我写了三个方法,分别分享到 新浪微博,Q空间,以及腾讯微博

~~~ 应该  encodeURIComponent()一下比较好

<!DOCTYPE html>
<html>
<head></head>
<body> <script> var ShareTip = function()
{ }
//分享到腾讯微博
ShareTip.prototype.sharetoqq=function(content,url,picurl)
{
var shareqqstring='http://v.t.qq.com/share/share.php? title='+content+'&url='+url+'&pic='+picurl;
window.open(shareqqstring,'newwindow','height=100,width=100,top=100,left=100');
}
//分享到新浪微博
ShareTip.prototype.sharetosina=function(title,url,picurl)
{
var sharesinastring='http://v.t.sina.com.cn/share/share.php? title='+title+'&url='+url+'&content=utf-8&sourceUrl='+url+'&pic='+picurl;
window.open(sharesinastring,'newwindow','height=400,width=400,top=100,left=100');
}
//分享到QQ空间
ShareTip.prototype.sharetoqqzone=function(title,url,picurl)
{
var shareqqzonestring='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey? summary='+title+'&url='+url+'&pics='+picurl;
window.open(shareqqzonestring,'newwindow','height=400,width=400,top=100,left=100');
} var share1=new ShareTip();
share1.sharetoqqzone("这是一本关于地图故事的集锦,以一本书的形式来展示地图故事,我们可 以使用鼠标拖动来翻页,或者点击翻页按钮,点击 马上体验,可以体验故事,同时在触屏上也有很好 的体验效果奥,地图故事,尽在书中,赶快体验吧,建议使用对 HTML5支持较好的浏览 器","http://tm.arcgisonline.cn:8038/App101/MapstoryBook/Default.html","http://tm.arcgisonl ine.cn:8038/App101/MapstoryBook/css/Img/ShareBook.jpg"); </script>
</body>
</html>

以上的函数分别具有三个参数,内容,网址,以及 图片,也就是我们想要分享的内容

最新文章

  1. 基本动画CABasicAnimation - 完成之后闪回初始状态
  2. 加载状态为complete时移除loading效果
  3. 未能找到元数据文件“引用的DLL的路径”
  4. centos7 php7 安装composer时Failed to decode zlib stream解决办法
  5. Pie Charts
  6. FileAttributes枚举
  7. JS中this到底指向谁?
  8. linux设置代理修改接口数据
  9. JAVA之旅(三十二)——JAVA网络请求,IP地址,TCP/UDP通讯协议概述,Socket,UDP传输,多线程UDP聊天应用
  10. docker daemon 配置文件
  11. ubuntu 16.04上 mysql 5.7 安装笔记
  12. 1.1.27 word表格里的文字不显示
  13. effective java——12考虑实现coparable接口
  14. Clover 3 --- Windows Explorer 资源管理器的一个扩展,为其增加类似谷歌 Chrome 浏览器的多标签页功能。
  15. Linux之Vim学习
  16. Android开发——高斯模糊效果的简单实现
  17. JS如何获取url查询字符串的键和值?
  18. List集合添加自定义对象
  19. Python全栈day 01
  20. shell sort 排序大讨论

热门文章

  1. josscrowcroft / Simple-JavaScript-DOM-Inspector
  2. poj 1459 (最大流)
  3. Android MediaPlayer Error -1004
  4. Android中各种Adapter的使用方法
  5. ZOJ 38727(贪心)
  6. How draw a stem -and -leaf &amp;amp; box-plot display by R.or Python
  7. git 使用笔记(三)-分支的使用
  8. vs2013出现ISO C++ conformant解决办法
  9. Spring学习之Aop的各种增强方法
  10. ORA-12514(TNS:监听程序当前无法识别...)