关于QQ空间的网站内嵌代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!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 = 'https://windeling.com/2023111169c64279/';
var _showcount = '1'
//分享链接后我的评论语句
var _desc = '说点什么吧';
//分享的描述
var _summary = 'Windeling的摄影作品';
//标题,设置的标题
var _title = '摄影作品-竹山村';
//设置名称,貌似没有什么用
var _site = '没有显示';
//添加的图片,最好是正方形的
var _pic = 'https://pic3.zhimg.com/80/v2-8a734f046386f6aaba97fb7c5d56f346_720w.webp';
// 图片宽度,不理解
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>

关于QQ空间的网站内嵌代码
https://blog.windeling.com/20231112e855684d/
作者
黄文林
发布于
2023年11月12日
更新于
2025年5月8日
许可协议