Repository navigation
Expand file tree
/
Copy path4-03.HTML Style.html
More file actions
89 lines (77 loc) · 2.23 KB
/
Copy path4-03.HTML Style.html
File metadata and controls
89 lines (77 loc) · 2.23 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
89
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.border-red {
border:2px dashed red;
}
.border-green {
border:2px solid green;
}
.border-default {
border-width:1px;
border-color:blue;
border-style:solid;
}
</style>
</head>
<body>
Text:
<br>
<input type="text" id="text1" onblur="changeBorder();">
<br> Radio(이메일 수신):
<br>
<label>
<input type="radio" name="radio_email_yn" value="Y" onclick="showEmail();"> 동의</label>
<label>
<input type="radio" name="radio_email_yn" value="N" onclick="hideEmail();" checked> 거부</label>
<div id="divEmail" style="display:none;">이메일 <input type="text" id="email"></div>
<br> Select:
<br>
<select id="select1" onchange="doChange(this);">
<option value=""></option>
<option value="KO">Korea</option>
<option value="CN">China</option>
<option value="JP">Japan</option>
</select>
<select id="select2" style="display:none;">
<option value="">서울</option>
<option value="">부산</option>
<option value="">대전</option>
<option value="">제주</option>
</select>
<button type="button" onclick="doSave();">Save</button>
<br>
<script>
function changeBorder(){
var text1 = document.getElementById("text1");
if(text1.value != "") {
text1.className = "border-green";
}
}
function showEmail() {
document.getElementById("divEmail").style.display = "";
}
function hideEmail() {
document.getElementById("divEmail").style.display = "none";
}
function doSave() {
var text1 = document.getElementById("text1");
if(text1.value == "") {
text1.className = "border-red";
return alert("필수값들을 입력하세요.");
}
console.log("doSave 실행합니다.");
}
function doChange(obj) {
if(obj.value == "KO") {
document.getElementById("select2").style.display = "";
}else {
document.getElementById("select2").style.display = "none";
}
}
</script>
</body>
</html>