-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex08.html
More file actions
113 lines (108 loc) · 3.83 KB
/
ex08.html
File metadata and controls
113 lines (108 loc) · 3.83 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {width: 100px;height: 20px;border: solid 2px black; margin: 10px;}
</style>
</head>
<body>
<!-- 인라인 이벤트 핸들러 -->
<div class="box" onclick="alert('Hello')" style="background-color: pink;">Alert</div>
<div id="box1" class="box" onclick="clk1()">클릭</div>
<div id="box2" class="box" ondblclick="clk2(' 바비')">더블 클릭</div>
<!-- 스크립트 이벤트 핸들러 -->
<div id="box3" class="box"></div>
<div id="box4" class="box" onclick=""></div>
<div id="box5" class="box" onclick=""></div>
<div id="box6" class="box" onclick=""></div>
<div id="box7" class="box" onclick=""></div>
<div id="box8" class="box" onclick=""></div>
<form action="" id="join_form" onsubmit="return join(this)" method="post">
<fieldset>
<legend>가입 정보</legend>
<table>
<tbody>
<tr>
<th>
<label for="field1">ID</label>
</th>
<td>
<input type="text" name="field1" id="field1" required autofocus>
</td>
</tr>
<tr>
<th>
<label for="field2">PW</label>
</th>
<td>
<input type="password" name="field2" id="field2" required>
</td>
</tr>
<tr>
<th>
<label for="field3">PW 확인</label>
</th>
<td>
<input type="password" name="field3" id="field3" required>
</td>
</tr>
<tr>
<th>
<label for="field4">이름</label>
</th>
<td>
<input type="text" name="field4" id="field4" required>
</td>
</tr>
<tr>
<th>
<label for="field5">이메일</label>
</th>
<td>
<input type="text" name="field5" id="field5" required>
</td>
</tr>
<tr>
<td>
<input type="submit">
</td>
<td>
<input type="reset">
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
<script>
// 이벤트 핸들러 on-으로 시작함
function clk1(){
alert("혼저옵서예")
}
function clk2(a){
alert("Hello"+a)
}
var box = document.getElementsByClassName("box");
for(var i=3; i<box.length; i++){
box[i].addEventListener("mouseover", function(e){
e.target.innerHTML="하이";
})
}
// 폼 입력값에 대한 유효성 검증
function join(frm){
console.log(frm.field3.value);
if(frm.field2.value == frm.field3.value){
return true;
}
else{
alret("비밀번호와 비밀번호 확인이 다릅니다");
return false;
}
}
var form = document.getElementById("join_form");
</script>
</body>
</html>