вот мой код:
Rows: <input type="text" id="rows" />
<br />
Cols: <input type="text" id="cols" />
<br>
Widht:<input type="text" id="widht" />
<div id="tableContainer"></div>
JavaScript:
let rows = document.getElementById('rows')
let cols = document.getElementById("cols")
let tableContainer = document.getElementById("tableContainer")
function buildTable() {
let table = 'Table:' + rows.value + "x" + cols.value;
table += '<table border=1 >';
for (let i = 1; i <= rows.value; i++) {
table += '<tr>';
for (let j = 1; j <= cols.value; j++)
table += '<td>' + i + "" + j + '</td>';
table += '</tr>';
}
table += '</table>';
tableContainer.innerHTML = table;
}
buildTable()
rows.oninput=function(){
buildTable()
}
cols.oninput=function(){
buildTable()
}