forked from toyprj-3/test_1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.html
More file actions
88 lines (80 loc) · 2.21 KB
/
create.html
File metadata and controls
88 lines (80 loc) · 2.21 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>게시물 작성하기</title>
<link rel="stylesheet" href="./css/create.css" />
</head>
<body>
<div id="logo" onclick="cancel()">
<a href="#"><img src="./media/logo.png" alt="로고 이미지" /></a>
</div>
<div id="write-area">
<form action="">
<div id="w-title">
<textarea
name="title"
id="title"
rows="1"
placeholder="제목을 입력해주세요"
required
></textarea>
</div>
<hr />
<div id="w-content">
<textarea
name="content"
id="content"
placeholder="내용을 입력해주세요"
required
></textarea>
</div>
<div id="img">
<input type="file" name="SelectFile" accept="image" />
</div>
<div id="buttons">
<div class="publish" onclick="publish()">
<button type="submit">발행하기</button>
</div>
<div class="cancel" onclick="cancel()">
<button>취소</button>
</div>
</div>
</form>
</div>
</body>
<script>
function publish() {
var result = confirm("등록하시겠습니까?");
if (result) {
if (
document.getElementById("content").value != "" &&
document.getElementById("title").value != ""
) {
alert("등록되었습니다.");
window.location.replace("main.html");
}
if (document.getElementById("title").value == "") {
alert("제목을 입력해 주세요.");
return;
}
if (document.getElementById("content").value == "") {
alert("내용을 입력해 주세요.");
return;
}
} else {
return;
}
}
function cancel() {
var back = confirm("글 작성을 취소하시겠습니까?");
if (back) {
alert("메인으로 돌아갑니다.");
window.location.replace("main.html");
} else {
return;
}
}
</script>
</html>