-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path220529.html
More file actions
37 lines (35 loc) · 863 Bytes
/
220529.html
File metadata and controls
37 lines (35 loc) · 863 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>테트리스 만들거야</title>
</head>
<style>
.internal{
color:red;
}
.clicked{
color:blue;
}
</style>
<body>
<h1>TEXT</h1>
<h1 class="internal">으아악</h1>
<h1 class="internal">호에엥</h1>
<script>
var internal = document.getElementsByClassName("internal");
function hc(event){
if (event.target.classList[1] === "clicked"){
event.target.classList.remove("clicked");
}else{
for (var i = 0; i<internal.length;i++){
internal[i].classList.remove("clicked");
}
event.target.classList.add("clicked");
}
}
for (var i=0; i<internal.length; i++){
internal[i].addEventListener("click", hc);
}
</script>
</body>
</html>