-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotice.js
34 lines (26 loc) · 883 Bytes
/
notice.js
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
let notices = [];
function postNotice() {
var title = document.getElementById("noticeTitle").value;
var content = document.getElementById("noticeContent").value;
var noticeObj = {
title: title,
content: content,
};
notices.push(noticeObj);
displayNotices();
}
function displayNotices() {
var noticeList = document.getElementById("noticeList");
noticeList.innerHTML = "";
for (var i = 0; i < notices.length; i++) {
var noticeItem = document.createElement("div");
noticeItem.classList.add("notice-item");
var title = document.createElement("p");
title.textContent = "공지 제목: " + notices[i].title;
var content = document.createElement("p");
content.textContent = "공지 내용: " + notices[i].content;
noticeItem.appendChild(title);
noticeItem.appendChild(content);
noticeList.appendChild(noticeItem);
}
}