body {
font-family: Arial, sans-serif;
margin: 25px;
}
h1 {
text-align: center;
color: #333;
}
h2 {
color: #333;
}
.comment-section {
margin-top: 30px;
}
form {
margin-top: 20px;
}
label {
font-weight: bold;
}
input[type="text"],
textarea {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
input[type="submit"] {
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.comment {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
.comment-author {
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.comment-date {
font-size: 12px;
color: #999;
}
.comment-message {
margin-top: 5px;
color: #333;
}
function formatDate(date) {
var monthNames = [
"一月", "二月", "三月",
"四月", "五月", "六月", "七月",
"八月", "九月", "十月",
"十一月", "十二月"
];
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear();
return day + + monthNames[monthIndex] + + year;
}
function createCommentElement(comment) {
var commentDiv = document.createElement(div);
commentDiv.className = "comment";
var author = document.createElement(div);
author.className = "comment-author";
author.appendChild(document.createTextNode(comment.author));
var date = document.createElement(div);
date.className = "comment-date";
date.appendChild(document.createTextNode(formatDate(new Date())));
var message = document.createElement(div);
message.className = "comment-message";
message.appendChild(document.createTextNode(comment.message));
commentDiv.appendChild(author);
commentDiv.appendChild(date);
commentDiv.appendChild(message);
return commentDiv;
}
function addComment() {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var message = document.getElementById("message").value;
var comment = {
author: name,
email: email,
message: message
};
var commentElement = createCommentElement(comment);
document.getElementById("comment-list").appendChild(commentElement);
// Reset input fields
document.getElementById("name").value = "";
document.getElementById("email").value = "";
document.getElementById("message").value = "";
}
document.getElementById("comment-list").innerHTML = "
"
" +
"
" +
"
相关游戏
Army Clash汉化中文版 v1.0
人在玩137MB
玩提供Army Clash中文版
Pixel Puzzles游戏苹果版 v1.0
人在玩141.1MB
玩提供Pixel Puzzles游
送命题保命指南游戏安卓版下载 v1.0.1
人在玩8.57MB
玩提供送命题保命指南游
古剑逍遥手游官方正式版 v4.3.0
人在玩144.73MB
玩提供古剑逍遥官方版下
保险杠汽车冲突骑游戏苹果版 v1.0
人在玩162MB
玩提供保险杠汽车冲突骑
相关文章
最新游戏
btgame手游盒子第一平台官网ios下载 v3.5.0
14.93MB2019-07-29
玩提供btgame手游第一
奇迹少女手游 v1.1.0
96.95MB2019-07-29
玩提供奇迹少女官方版
真龙传奇手游官方最新版下载 v0.0.2
105.47MB2019-07-29
玩提供真龙传奇手游下
修仙飞升传手游官网版下载 v1.01
112.71MB2019-07-29
玩提供修仙飞升传官网
进击的阿斯托拉诺伦之秘手游 v1.0
804.18MB2019-07-29
玩提供进击的阿斯托拉
网友评论