分享代码2

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
String pathShare = request.getContextPath();
String basePathShare = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pathShare+"/";
%>
<script>
function postToQt()
{
	var objName = jQuery.find("span.title");
	var name = '';
	if(objName.length > 0)
	{
		name = jQuery.find("span.title")[0].innerHTML;	
	}
	
	var shareTitle = document.title + ':' + name;

	var pTQt = getId('postToQtF'); 
	getId('QQmsg').value = shareTitle + ' ' + location.href; 
	getId('QQreturn').value = location.href; 
	pTQt.submit();  
}

function postToWeibo(){
	var titleSina = ''; 
	if(jQuery.find('span.title').length > 0){
		titleSina=document.title + ':'+jQuery.find('span.title')[0].innerHTML; 
	}  
	window.open('http://weibo.cn/ext/share?ru='+encodeURIComponent(location.href)+'&rt='+encodeURIComponent(titleSina)+'&st='+(new Date()).getTime());
	
}

</script>
<form name='postToQtF' id="postToQtF" target='_blank' style="height: 0; width: 0; overflow: hidden;" action="http://ti.3g.qq.com/open/s?aid=share" method="post">
  <input type="hidden" name="sbid" value="801227397" />
  <input type="hidden" name="msg" id="QQmsg" value="" />
  <!-- 无图片可删除此项 
  <input type="hidden" name="image" value="替换此处为图片的链接" />-->
  <!-- 返回链接必须与申请时的域名一致 -->
  <input type="hidden" name="return" id="QQreturn" value="" />
  <input type="hidden" name="g_ut" value="2" />
  <input type="submit" value="分享至腾讯微博" />
</form>
<a href="javascript:void(0);" onclick="postToQt();" title="分享到腾讯微博" ><img src="<%=basePathShare %>resources/images/s1.png"/></a>
<a href="javascript:void(0);" onclick="postToWeibo();" target="_blank"  title="新浪微博分享"><img src="<%=basePathShare %>resources/images/s2.png"/></a>
<a href="javascript:void(0);" onclick="window.open('http://sns.z.qq.com/share?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title));return false;" target="_blank" title="分享到QQ空间"><img src="<%=basePathShare %>resources/images/s3.png"/></a>

<a href="javascript:void(0);" onclick="window.open('http://3g.163.com/t/checkLogin.do?info='+encodeURIComponent(document.title)+'&source='+encodeURIComponent(document.title)+'&link='+encodeURIComponent(document.location.href));return false;" target="_blank" title="分享到QQ空间"><img src="<%=basePathShare %>resources/images/s10.png"/></a>

<!--http://3g.163.com/t/checkLogin.do?info=与手机网易合作&source=手机网易网&link=http://3g.163.com/ntes/09/1225/15/5RD102AK00964271.html&mobilewbco=nb_sjwyw_wzy_p4_分享到网易微博-->
 

你可能感兴趣的:(share)