-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5_done.html
More file actions
42 lines (38 loc) · 1.21 KB
/
5_done.html
File metadata and controls
42 lines (38 loc) · 1.21 KB
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
<!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>
</head>
<body>
<table id="table">
<tr>
<th>Achternaam</td>
<th>Nummer</th>
<th>email</th>
</tr>
</table>
<script>
// 6) Zet een tweedimensionele array in een tabel (4 punten)
// De array $lijst bevat 5 adressen met elk de achternaam, telefoonnummer en mailadres. De opdracht is om deze array met een onbepaald aantal regels om te zetten in een HTML tabel.
// https://www.w3schools.com/html/html_tables.asp
var items = [
["Hans", "123456789", "test1@gmail.com"],
["Jan", "346436455", "test2@gmail.com"],
["Kaas", "456456546", "test3@gmail.com"],
["geladen", "345384544", "test4@gmail.com"],
["Kaas", "3242423424", "test5@gmail.com"],
];
var table = document.getElementById("table");
items.forEach((item, i) => {
console.log(item, i)
var row = table.insertRow(i + 1);
row.insertCell(0).innerHTML = item[0];
row.insertCell(1).innerHTML = item[1];
row.insertCell(2).innerHTML = item[2];
})
</script>
</body>
</html>