function gerar() { let tab = window.document.getElementById('seltab') let ini = window.document.getElementById('cxct1') if (ini.value.length == 0) { window.alert('Valor inválido') } else { let n = Number(ini.value) for (let c = 1; c <= 10; c++) { let item = document.getElementById('res') res.text = `${n} x ${c} = ${n*c}` tab.appendChild(item) } } }