JavaScript分享新浪微博、QQ空间、腾讯微博

一、先看效果图:

如图:是分享新浪微博的页面。

二、分享新浪微博、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、腾讯微博


发布了45 篇原创文章 · 获赞 12 · 访问量 15万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章