summaryrefslogtreecommitdiff
path: root/wk8/lect/background.html
diff options
context:
space:
mode:
Diffstat (limited to 'wk8/lect/background.html')
-rw-r--r--wk8/lect/background.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/wk8/lect/background.html b/wk8/lect/background.html
new file mode 100644
index 0000000..114e3e8
--- /dev/null
+++ b/wk8/lect/background.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <title>background</title>
+ </head>
+ <body>
+ <button id="red">R</button>
+ <button id="green">G</button>
+ <button id="blue">B</button>
+ <script>
+
+ let body = document.querySelector('body');
+ document.querySelector('#red').addEventListener('click', function() {
+ body.style.backgroundColor = 'red';
+ });
+ document.querySelector('#green').addEventListener('click', function() {
+ body.style.backgroundColor = 'green';
+ });
+ document.querySelector('#blue').addEventListener('click', function() {
+ body.style.backgroundColor = 'blue';
+ });
+
+ </script>
+ </body>
+</html>
+