[javascript]代码库
<!-- 转载自http://www.phpernote.com/javascript-function/333.html -->
<html>
<head>
<title>www.phpernote.com</title>
<script language="javascript">
function sharePlugin(name,img,title){
var purl=encodeURIComponent(document.location.href);
switch(name){
case 'sina':
var url='http://service.t.sina.com.cn/share/share.php?url='+purl+'&appkey=2858164115&title='+encodeURIComponent(""+title)+'&pic='+encodeURIComponent(img)+'&ralateUid=&searchPic=false';//注意这个地方使用了一个appkey,分享到新浪的时候会有一个分享来源,其中的分享来源就取决于这个appkey,你可以根据需要改成自己的appkey
window.open(url);
break;
case 'tqq':
var url='http://v.t.qq.com/share/share.php?title='+encodeURIComponent(""+title)+'&url='+purl+'&appkey='+encodeURI("8675d8896e054316bc69755118dea3c9")+'&site='+purl+'&pic='+img;
window.open( url,'转播到腾讯微博','width=700,height=680,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,location=yes,resizable=no,status=no' );
break;
case 'kaixin':
var url='http://www.kaixin001.com/repaste/share.php?rurl='+purl+'&rcontent='+encodeURIComponent(""+title)+'&rtitle='+encodeURIComponent("欣和食与家");
window.open(url);
break;
case 'renren':
var url='http://share.renren.com/share/buttonshare.do?link='+purl+'&title='+encodeURIComponent(""+title);
window.open(url);
break;
case 'douban':
var url='http://www.douban.com/recommend/?url='+purl+'&title='+encodeURIComponent(""+title);
window.open(url);
break;
case 'qzone':
var url='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(""+title)+'&pics='+img;
window.open(url);
break;
}
}
</script>
</head>
<body>
<a href="#" onclick="sharePlugin('renren','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到人人网</a>
<br />
<a href="#" onclick="sharePlugin('tqq','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到腾讯微博</a>
<br />
<a href="#" onclick="sharePlugin('sina','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到新浪微博</a>
<br />
<a href="#" onclick="sharePlugin('kaixin','http://www.phpernote.com/images/logo.gif','http://www.phpernote.com')">分享到开心网</a>
</body>
</html>