-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (55 loc) · 1.88 KB
/
index.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
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="warp">
<h1>#100DAYSCHALLENGE</h1>
<p>I hope I can keep it up.</p>
<div class="intro">
<div class="img">
<img src="./IMG_0604.JPG" alt="machi" />
</div>
</div>
<table id="challenge">
<thead>
<tr>
<th>Day</th>
<th>challenge</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
<script>
console.log(document.querySelector('#challenge').children[1].innerHTML);
window.onload = () => {
fetch('./info.json')
.then((res) => res.json())
.then((res) => {
console.log(res);
let sInfo = '';
for (const key in res.challenge) {
const { name, url, number } = res.challenge[key];
sInfo += `
<tr data-key="${key}">
<td>${number}</td>
<td><a href="${url}">${name}</a></td>
</tr>
`;
}
document.querySelector('#challenge').children[1].innerHTML = sInfo;
});
};
</script>
</body>
</html>