-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (24 loc) · 768 Bytes
/
Copy pathscript.js
File metadata and controls
26 lines (24 loc) · 768 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
let day = 1;
for (let i = 1; i < 26; i++) {
if (i <= day) {
document.getElementById("buttons").innerHTML +=
"<button onclick='showDay(" + i + ")'>day " + i + "</button>";
}
else {
document.getElementById("buttons").innerHTML +=
"<button disabled style='opacity:0.50;'>day " + i + "</button>";
}
}
showDay(day);
function showDay(day) {
document.getElementById("answer").innerHTML = "";
document.getElementById("code").innerHTML = '<pre><code id="jscode" class="language-javascript"></code></pre>';
fetch("day" + day + "/script.js")
.then((response) => response.text())
.then((data) => {
console.log(data);
document.getElementById("jscode").innerHTML = data;
hljs.highlightAll();
eval(data);
});
}