-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript실습문제3.html
More file actions
78 lines (67 loc) · 2.53 KB
/
JavaScript실습문제3.html
File metadata and controls
78 lines (67 loc) · 2.53 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
<html lang="ko">
<head>
<title>연습 3</title>
<style>
#filedset {
background: lightgray;
width: 450px;
}
.area {
margin: 10px;
padding: 10px;
background: yellow;
width: 480px;
height: 80px;
display: none;
}
</style>
</head>
<body>
<h1>연습 3</h1>
<fieldset id="filedset" style="text-align : center;">
<legend><b>검색할 항목을 선택하세요.</b></legend>
<input type="radio" name="radio" value="제목" id="title" onclick="clic();" value="제목">
<label>제목</label>
<input type="radio" name="radio" value="날짜" id="date" onclick="clic();" value="날짜">
<label>날짜</label>
<input type="radio" name="radio" value="작성자" id="writer" onclick="clic();" value="작성자">
<label>작성자</label>
</fieldset>
<hr>
<div id="area1" class="area">
<label>검색할 제목을 입력하세요. </label><br>
<input type="text" id="text" size="50">
<input type="submit" value="검색">
</div>
<div id="area2" class="area">
<label>검색할 날짜를 선택하세요.</label><br>
<input type="date" size="15">
<input type="date" size="15">
<input type="submit" value="검색">
</div>
<div id="area3" class="area">
<label>검색할 작성자 아이디를 입력하세요:</label><br>
<input type="text" id="id" size="30">
<input type="submit" value="검색">
</div>
<script>
function clic(){
if (document.getElementById("title").checked) {
document.getElementById("area1").style.display = "block";
document.getElementById("area2").style.display = "none";
document.getElementById("area3").style.display = "none";
}
if (document.getElementById("date").checked) {
document.getElementById("area1").style.display = "none";
document.getElementById("area2").style.display = "block";
document.getElementById("area3").style.display = "none";
}
if (document.getElementById("writer").checked) {
document.getElementById("area1").style.display = "none";
document.getElementById("area2").style.display = "none";
document.getElementById("area3").style.display = "block";
}
}
</script>
</body>
</html>