-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
48 lines (43 loc) · 1.2 KB
/
test.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
<!DOCTYPE html>
<html>
<head>
<title>Facts from JSON</title>
<style>
body {
font-family: Arial, sans-serif;
}
.fact {
margin: 20px 0;
}
.fact h2 {
color: #333;
}
.fact p {
color: #666;
}
</style>
</head>
<body>
<h1>Facts and Descriptions</h1>
<div id="content"></div>
<script>
fetch('Facts0V2.json')
.then(response => response.json())
.then(data => {
var content = document.getElementById('content');
data.forEach(function(item) {
var factDiv = document.createElement('div');
factDiv.className = 'fact';
var factTitle = document.createElement('h2');
factTitle.textContent = item.Fact;
factDiv.appendChild(factTitle);
var factDescription = document.createElement('p');
factDescription.textContent = item.Description;
factDiv.appendChild(factDescription);
content.appendChild(factDiv);
});
})
.catch(error => console.error('Error:', error));
</script>
</body>
</html>