var n=10; var s; document.write("<table>"); for (i=1; i<=n; i=i+1) {document.write("<tr>") for (j=1;j<=n; j=j+1) { st = (i + j) % 3; if (st == 0) s = "class='r1'"; else s="class='r2'"; document.write("<td "+s+"> </td>"); } document.write("</tr>"); } document.write("</table>");
border-collapse:collapse;
}
td {
width: 50px;
height: 50px
}
.r1 {
background-color:rgb(163, 47, 148);
border: 5px solid white;
}
.r2 {
background-color: rgb(60, 60, 135);
border: 5px solid white;
}
var n=10;
var s;
document.write("<table>");
for (i=1; i<=n; i=i+1)
{document.write("<tr>")
for (j=1;j<=n; j=j+1)
{
st = (i + j) % 3;
if (st == 0) s = "class='r1'";
else s="class='r2'";
document.write("<td "+s+"> </td>");
}
document.write("</tr>");
}
document.write("</table>");