-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
43 lines (38 loc) · 1.45 KB
/
index.html
File metadata and controls
43 lines (38 loc) · 1.45 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
<!DOCTYPE html>
<html lang="ja">
<head>
<title>Ceiling Light Remote Controller</title>
<link rel="stylesheet" href="./style.css">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="apple-touch-icon" type="image/png" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/icon-192x192.png">
</head>
<body>
<header>Ceiling Light Remote Controller</header>
<div class="btn" id="switch">Power</div>
<div class="btn" id="bright">+</div>
<div class="btn" id="dark">-</div>
<script>
let request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4) {
if (request.status == 200) {
console.log(request.responseText)
}
}
}
document.querySelector("#switch").addEventListener("click", function () {
request.open("GET", "./cgi-bin/cgir.py?command=ceiling-sw");
request.send(null);
});
document.querySelector("#bright").addEventListener("click", function () {
request.open("GET", "./cgi-bin/cgir.py?command=ceiling-bright");
request.send(null);
});
document.querySelector("#dark").addEventListener("click", function () {
request.open("GET", "./cgi-bin/cgir.py?command=ceiling-dark");
request.send(null);
});
</script>
</body>
</html>