moving all labs to old dir

This commit is contained in:
2026-02-26 21:55:48 +10:00
parent 76555d27a4
commit 4f1c66e838
132 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
const createTable = (data, idTable) => {
const table = document.getElementById(idTable);
const header = Object.keys(data[0]);
/* создание шапки таблицы */
const headerRow = createHeaderRow(header);
table.append(headerRow);
/* создание тела таблицы */
const bodyRows = createBodyRows(data);
table.append(bodyRows);
};
const clearTable = (idTable) => {
const table = document.getElementById(idTable);
table.removeChild(table.children[1]);
}
const createHeaderRow = (headers) => {
const tr = document.createElement('tr');
headers.forEach(header => {
const th = document.createElement('th');
th.innerHTML = header;
tr.append(th);
});
return tr;
};
const createBodyRows = (rows) =>{
const body = document.createElement('tbody');
rows.forEach(row =>{
const rowElement = document.createElement('tr');
for (let key in row) {
const td = document.createElement('td');
td.innerHTML = row[key];
rowElement.appendChild(td);
}
body.appendChild(rowElement);
})
return body;
}