-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolorss.html
More file actions
45 lines (34 loc) · 991 Bytes
/
colorss.html
File metadata and controls
45 lines (34 loc) · 991 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
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="./colors.css">
</head>
<body>
<ul class="switcher">
<li id="grayButton"></li>
<li id="whiteButton"></li>
<li id="navyButton"></li>
</ul>
<h1>Theme Switcher</h1>
<p>테마를 바꿔봅시다.</p>
<script>
const body = document.querySelector('body')
const grayBtn = document.querySelector('#grayButton')
const whiteBtn = document.querySelector('#whiteButton')
const navyBtn = document.querySelector('#navyButton')
grayBtn.addEventListener('click', function () {
body.style.backgroundColor = 'pink'
body.style.color = 'black'
})
whiteBtn.addEventListener('click', function () {
body.style.backgroundColor = 'purple'
body.style.color = 'white'
})
navyBtn.addEventListener('click', function () {
body.style.backgroundColor = 'green'
body.style.color = 'white'
})
</script>
</body>
</html>