-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript17.html
More file actions
49 lines (40 loc) · 1.32 KB
/
JavaScript17.html
File metadata and controls
49 lines (40 loc) · 1.32 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
<html lang="ko">
<head>
<title>이벤트</title>
<style>
.area{
background: lightgray;
border: 1px solid black;
height: 100px;
}
</style>
</head>
<body>
<h1>이벤트</h1>
<h3>고전 이벤트 모델</h3>
<button id = "test1">test1() 실행확인</button>
<button id = "test2">test2() 실행확인</button>
<div id="area1" class="area"></div>
<script>
var test1 = document.getElementById("test1");
var test2 = document.getElementById("test2");
test1.onclick = function(){
var area1 = document.getElementById("area1");
area1.innerHTML += "test1()이 실행되었습니다. <br>";
}
test2.onclick = function(){
var area1 = document.getElementById("area1");
area1.innerHTML += "test2()이 실행되었습니다. <br>";
}
</script>
<br>
<h3>인라인 이벤트 모델</h3>
<button onclick="test3();">실행확인</button>
<div id="area3" class="area"></div>
<script>
function test3(){
alert("test3() 실행확인");
}
</script>
</body>
</html>