话不多说,直接上代码……复制即可使用
若是失效请及时联系我更新
<!DOCTYPE HTML>
<html>
<head><title>QQ空间分享</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body><input type="button" onclick="shareQQzone();" value="分享"></input>
</body>
<script src="http://qzonestyle.gtimg.cn/qzone/app/qzlike/qzopensl.js#jsdate=20111201" charset="utf-8"></script>
<script>//QQ空间分享方法:这样写可以对分享事件进行绑定function shareQQzone(){//这里填写跳转的网站var _url = 'wenmeng.online';var _showcount = '1'//分享链接后我的评论语句var _desc = '我要回家,来啊';//分享的描述var _summary = '有一起拼车的吗,一起拼车吧';//标题,设置的标题var _title = '平院——>火车站';//设置名称,貌似没有什么用var _site = '没有显示';//添加的图片,最好是正方形的var _pic = 'https://wenmeng.online/images/wm.png';// 图片宽度,不理解var _width= '800px';// 图片高度,不理解var _height= '200px';//分享的链接,由上面属性拼接而成var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';_shareUrl += 'url=' + encodeURIComponent(_url||document.location); //参数url设置分享的内容链接|默认当前页location_shareUrl += '&showcount=' + _showcount||0; //参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示_shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述'); //参数desc设置分享的描述,可选参数_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要'); //参数summary设置分享摘要,可选参数_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //参数title设置分享标题,可选参数_shareUrl += '&site=' + encodeURIComponent(_site||''); //参数site设置分享来源,可选参数_shareUrl += '&pics=' + encodeURIComponent(_pic||''); //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');}
</script>
</html>