网站举报按钮代码 - 如何在页面添加举报功能
<html>
<head>
<title>举报按钮</title>
<style>
.report-btn {
position: fixed;
bottom: 20px;
right: 20px;
width: 80px;
height: 40px;
background-color: #f00;
color: #fff;
text-align: center;
line-height: 40px;
cursor: pointer;
}
</style>
</head>
<body>
<div class='report-btn' onclick='openReportPage()'>举报</div>
<pre><code><script>
function openReportPage() {
// 使用模态框弹出举报内容
var reportModal = document.createElement('div');
reportModal.innerHTML = '<h1>举报内容</h1>'; // 这里可以添加你的举报表单或其他内容
reportModal.style.position = 'fixed';
reportModal.style.top = '0';
reportModal.style.left = '0';
reportModal.style.width = '100%';
reportModal.style.height = '100%';
reportModal.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
reportModal.style.display = 'flex';
reportModal.style.justifyContent = 'center';
reportModal.style.alignItems = 'center';
document.body.appendChild(reportModal);
}
</script>
</code></pre>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/Ib9 著作权归作者所有。请勿转载和采集!