<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>动态实现分享到~方法</title> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script> </head> <body> <!-- 通过获取地址栏的网址来动态分享 --> <a class="qq" href="qqname" target="_blank">QQ空间</a></br> <a class="xlwb" href="xlwbname">新浪微博</a> </br> <a class="txwb" href="txwbname" target="_blank">腾讯微博</a> </body> <script> //分享到QQ空间 var qqname="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+location.href $(".qq").attr("href",qqname); //分享到新浪微博 var xlwbname="http://v.t.sina.com.cn/share/share.php?url="+location.href $(".xlwb").attr("href",xlwbname); //分享到腾讯微博 var qqname="http://v.t.qq.com/share/share.php?url="+location.href $(".txwb").attr("href",txwbname); </script> </html>