-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamic-table.html
44 lines (44 loc) · 1.49 KB
/
dynamic-table.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
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<script>
const table = document.createElement('table');
const tbody = document.createElement('tbody');
const tr1 = document.createElement('tr');
const tr2 = tr1.cloneNode();
const tr3 = tr1.cloneNode();
const tr4 = tr1.cloneNode();
const th1 = document.createElement('th');
const th2 = th1.cloneNode();
const td1 = document.createElement('td');
const td2 = td1.cloneNode();
const td3 = td2.cloneNode();
const td4 = td3.cloneNode();
const td5 = td4.cloneNode();
const td6 = td5.cloneNode();
document.body.append(table);
table.append(tbody);
tbody.append(tr1, tr2, tr3, tr4);
tr1.append(th1, th2);
tr2.append(td1, td2);
tr3.append(td3, td4);
tr4.append(td5, td6);
th1.append('Browser');
th2.append('Company');
tr1.append(th1, th2);
td1.append('Edge');
td2.append('Microsoft');
tr2.append(td1, td2);
td3.append('Internet Explorer');
td4.append('Microsoft');
tr3.append(td3, td4);
td5.append('Chrome');
td6.append('Google');
tr4.append(td5, td6);
</script>
</body>
</html>