function createMultiplicationTable(rows, columns) {
let html = '
';
for(let rowNumber = 1; rowNumber <= rows; rowNumber++) {
html = html + '';
for(let columnNumber = 1; columnNumber <= columns; columnNumber++) {
html = html + `${rowNumber * columnNumber} | `;
}
html = html + '
';
}
html = html + '
';
return html;
}
function onGeneratePressed() {
let rowsInput = document.getElementById("rows-input").value;
let columnsInput = document.getElementById("columns-input").value;
let rows = Number(rowsInput);
let columns = Number(columnsInput);
if (isNaN(rows) || isNaN(columns)) {
alert("Invalid input! Please enter numbers only.");
return;
}
let tableHTML = createMultiplicationTable(rows, columns);
document.getElementById("table-container").innerHTML = tableHTML;
}