JavaScript分享新浪微博、QQ空间、腾讯微博
2016-06-04 17:42
816 查看
一、先看效果图:
如图:是分享新浪微博的页面。二、分享新浪微博、QQ空间、腾讯微博的JavaScript代码
<script type="text/javascript"> function sharexinlang(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=100,width=100,top=100,left=100'); } function shareqqkongjian(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'); } function weixinShareTimeline(content,link,imgUrl){ var shareqqstring='http://v.t.qq.com/share/share.php?title='+content+'&url='+link+'&pic='+imgUrl; window.open(shareqqstring,'newwindow','height=100,width=100,top=100,left=100'); } </script>
三、调用方式
<div> <div style="display: inline-block;float: right;margin-right: 35px;"> <a href="javascript:sharexinlang('${video.introduce}','<%=baseURL %>/playVideo.do?videoId=${video.videoId }','<%=baseURL %>/file/${video.imgPath }')"><img src="<%=baseURL %>/images/xinlang.png"/></a> </div> <div style="display: inline-block;float: right;"> <a href="javascript:shareqqkongjian('${video.introduce}','<%=baseURL %>/playVideo.do?videoId=${video.videoId }','<%=baseURL %>/file/${video.imgPath }')"><img src="<%=baseURL %>/images/kongjian.png"/></a> </div> <div style="display: inline-block;float: right;"> <a href="javascript:weixinShareTimeline('${video.introduce}','<%=baseURL %>/playVideo.do?videoId=${video.videoId }','<%=baseURL %>/file/${video.imgPath }')"> <img src="<%=baseURL %>/images/weibo.png"></img> </a> </div> <div style="display: inline-block;float: right;"> <font class="title clearfix yh f16">分享本视频: </font> </div> <div style="display: inline-block;float: right;"> <font class="title clearfix yh f16"> <a href="<%=baseURL%>/web/add_discuss.jsp?videoId=${video.videoId}&videoName=${video.videoName }"> 我要评论 </a> </font> </div> </div>
四、调用完成,点击对应的分享跳出分享页面。
1、新浪微博2、QQ空间
3、腾讯微博
相关文章推荐
- JQuery1——基础($对象,选择器,对象转换)
- Android学习笔记(二九):嵌入浏览器
- Android java 与 javascript互访(相互调用)的方法例子
- 【CF 应用开发大赛】IT Share(IT分享网)
- JavaScript演示排序算法
- javascript实现10进制转为N进制数
- 最后一次说说闭包
- Ajax
- 2019年开发人员应该学习的8个JavaScript框架
- HTML中的script标签研究
- 对一个分号引发的错误研究
- 异步流程控制:7 行代码学会 co 模块
- ES6 走马观花(ECMAScript2015 新特性)
- JavaScript拆分字符串时产生空字符的原因
- Canvas 在高清屏下绘制图片变模糊的解决方法
- Redux系列02:一个炒鸡简单的react+redux例子
- JavaScript 各种遍历方式详解