-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabla.html
98 lines (74 loc) · 2.66 KB
/
tabla.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!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>Leyenda</title>
<style>
table{
width: 100%;
}
</style>
</head>
<body>
<div id="main">
<h1>Leyenda</h1>
</div>
<script>
(function(){
fetch('bombo.json')
.then(response => response.json())
.then(cargarTablas);
let main = document.getElementById("main")
function cargarTablas(data){
let songs = data
let bombos = Object.keys(songs);
bombos.forEach((elem, i, arr) => {
let h2 = document.createElement("h2");
h2.textContent=elem;
main.append(h2);
let table = document.createElement("table");
let tCabecera = document.createElement("tr")
let thCuenta = document.createElement("th");
thCuenta.textContent = "#"
let thTitulo = document.createElement("th");
thTitulo.textContent = "Titulo"
let thAutor = document.createElement("th");
thAutor.textContent = "Autor"
let thCancion = document.createElement("th");
thCancion.textContent = "Cancion"
let thBola = document.createElement("th");
thBola.textContent = "Bola"
tCabecera.append(thCuenta)
tCabecera.append(thTitulo)
tCabecera.append(thAutor)
tCabecera.append(thCancion)
tCabecera.append(thBola)
table.append(tCabecera);
data[elem].forEach((elem,i,arr) => {
let tRow = document.createElement("tr")
let tdCuenta = document.createElement("td");
tdCuenta.textContent = i+1;
let tdTitulo = document.createElement("td");
tdTitulo.textContent = elem.titulo;
let tdAutor = document.createElement("td");
tdAutor.textContent = elem.autor;
let tdCancion = document.createElement("td");
tdCancion.textContent = elem.src;
let tdBola = document.createElement("td");
tdBola.textContent = elem.bola;
tRow.append(tdCuenta);
tRow.append(tdTitulo);
tRow.append(tdAutor);
tRow.append(tdCancion);
tRow.append(tdBola);
table.append(tRow);
} )
main.append(table)
})
}
})()
</script>
</body>
</html>