Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>OIE</title>
- <style>
- table {
- width: 30%;
- border: 1px solid black;
- text-align: center;
- }
- tr {
- width: 100%;
- }
- .preto {
- background: #000;
- }
- </style>
- </head>
- <body>
- <script>
- var tamanho = 5;
- document.write("<table>");
- for (var i = 0; i < tamanho;i++) {
- document.write("<tr>");
- for (var j = 0; j < tamanho; j++) {
- if ((i + j) % 2 == 0) {
- document.write("<td class=\"preto\">0</td>");
- } else {
- document.write("<td class=\"branco\"></td>");
- }
- }
- document.write("</tr>");
- }
- document.write("</table>");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement