在社交网站和微博满天飞的时候,怎么让自己网页快速分享给好友?下面介绍开心网,人人网,新浪微博和腾讯微博一键分享的方法。
在HTML代码中加入如下
在网页尾部加入如下Javascript代码
新浪微博的分享可以z指定{source}和{sourceUrl},腾讯微博可以指定{site},将这几个变量替换成你想要的内容即可。
这样你的网页就拥有一键分享功能。
在HTML代码中加入如下
<a id="share2kaixin" href="#" target="_blank"><img src="images/p2_10.gif" width="16" height="28" alt="分享到开心网" /></a>
<a id="share2renren" href="#" target="_blank"><img src="images/p2_11.gif" width="16" height="28" alt="分享到人人网" /></a>
<a id="share2sina" href="#" target="_blank"><img src="images/p2_12.gif" width="16" height="28" alt="分享到新浪微博" /></a>
<a id="share2qq" href="#" target="_blank"><img src="images/p2_13.gif" width="16" height="28" alt="分享到腾讯微博" /></a>
在网页尾部加入如下Javascript代码
<script type="text/javascript">
var p_url = encodeURIComponent(top.location.href);
var p_title = encodeURIComponent(top.document.title);
var p_pic = "";
var share_kaixin = document.getElementById("share2kaixin");
var share_renren = document.getElementById("share2renren");
var share_sina = document.getElementById("share2sina");
var share_qq = document.getElementById("share2qq");
if(share_kaixin) share_kaixin.href = "http://www.kaixin001.com/repaste/share.php?rurl=" + p_url+"&rtitle="+p_title + "&rcontent=" + p_url;
if(share_renren) share_renren.href = "http://share.renren.com/share/buttonshare.do?link=" + p_url + "&title=" + p_title;
if(share_sina) share_sina.href = "http://v.t.sina.com.cn/share/share.php?url="+ p_url+"&title="+p_title+"&source={source}&sourceUrl={sourceUrl}&content=utf8&pic="+p_pic;
if(share_qq) share_qq.href = "http://v.t.qq.com/share/share.php?url="+p_url+"&title="+p_title+"&site={site}n&pic="+p_pic;
</script>
新浪微博的分享可以z指定{source}和{sourceUrl},腾讯微博可以指定{site},将这几个变量替换成你想要的内容即可。
这样你的网页就拥有一键分享功能。