-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08.html
54 lines (48 loc) · 1.15 KB
/
08.html
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
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<title>DOM EXAMPLE</title>
<script>
function print(e, m) {
document.getElementById(e).innerHTML += `<div>${m}</div>`;
}
function hide(...n) {
n.forEach(e => {
document.getElementById(e).innerHTML = "X";
});
}
function show(...n) {
n.forEach(e => {
document.getElementById(e).innerHTML = e;
});
}
function toggle(name) {
print("event_log", name);
hide(name);
switch(name) {
case 'A':
show('B', 'C');
break;
case 'B':
show('A', 'C');
break;
case 'C':
show('A', 'B');
break;
};
}
</script>
</head>
<body>
<h1>DOM EXAMPLE</h1>
<h2>Known Actions</h2>
<div>
<button id='A' type="button" onclick="toggle('A');">A</button>
<button id='B' type="button" onclick="toggle('B');">B</button>
<button id='C' type="button" onclick="toggle('C');">C</button>
</div>
<h2>Server Output</h2>
<div id='event_log'></div>
</body>
</html>