0
I’ve done the table code, but I don’t know how to color the columns.
<script>
window.onload = function tabela(){
var lin = prompt("linha");
lin = parseInt(lin);
var col = prompt("coluna");
col = parseInt(col);
var conteudo = "<table border = 0>";
for (i=1;i<=lin;i++){
conteudo += "<tr>";
for (j=1;j<=col;j++){
conteudo += "<td>" + (i+","+j)+"</td>"
}
conteudo += "</tr>";
}
conteudo += "</table>";
document.getElementById("tab").innerHTML = conteudo;
</script>
</head>
<body>
<div id="tab"></div>
</body>
</html>
I’ve formatted your code, but you need to fix the indentation and see if you’re missing one
}
at the end. Please review the code if possible. I took a few blank lines just to avoid the need to scroll while reading your code. To change/fix, just click on [Edit].– Bacco