-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite.html
93 lines (74 loc) · 2.33 KB
/
write.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page Title</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
box-sizing: border-box;
}
textarea {
width: 100%;
height: 150px;
padding: 10px;
margin-bottom: 15px;
box-sizing: border-box;
}
button {
background-color: #A9A9A9;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #696969;
}
</style>
</head>
<body>
<div class="container">
<button onclick="goBack()">Back</button>
<h2>제목</h2>
<input type="text" id="titleInput" placeholder="Title">
<h2>내용</h2>
<textarea id="contentInput" placeholder="..."></textarea>
<button onclick="doneClicked()">Done</button>
</div>
<script>
function goBack() {
window.location.href = 'http://127.0.0.1:5500/index.html';
}
function doneClicked() {
var title = document.getElementById('titleInput').value;
var content = document.getElementById('contentInput').value;
var titles = JSON.parse(localStorage.getItem('titles')) || [];
titles.push(title);
localStorage.setItem('titles', JSON.stringify(titles));
var notes = JSON.parse(localStorage.getItem('notes')) || [];
var note = {
title: title,
content: content
};
notes.push(note);
localStorage.setItem('notes', JSON.stringify(notes));
document.getElementById('titleInput').value = '';
document.getElementById('contentInput').value = '';
updateNoteList();
}
</script>
</body>
</html>