diff --git a/static/ad.html b/static/ad.html index 1f72409..f558226 100644 --- a/static/ad.html +++ b/static/ad.html @@ -7,8 +7,8 @@ /* 让页面内容充满整个视口 */ html, body { height: 100%; - margin: 0; - padding: 0; + margin: 10px; + padding: 10px; } /* 居中显示内容 */ @@ -24,64 +24,65 @@ max-width: 100%; height: auto; } + + /* 页脚样式 */ + footer { + position: fixed; + bottom: 0; + width: 100%; + background-color: #f0f0f0; + text-align: center; + padding: 5px 0; + }
-
+
+
-
+ };
+ xhr.open('GET', 'ad_get_visit_count.php', true);
+ xhr.send();
+ }
+
+ // 点击图片时触发的函数,用于向后端发送访问计数请求
+ function trackVisit() {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', 'ad_visit.php', true);
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+ getVisitCount(); // 更新访问次数显示
+ }
+ };
+ xhr.send();
+
+ // 更新图片的点击链接,可以将其指向实际的广告目标链接
+ document.getElementById('adImage').parentNode.href = "https://www.521f.com";
+ }
+
+ // 页面加载完成后获取并显示访问次数
+ window.onload = function() {
+ getVisitCount();
+ };
+