|
@@ -0,0 +1,71 @@
|
|
|
+<header>
|
|
|
+ <h1>Multiply table</h1>
|
|
|
+</header>
|
|
|
+
|
|
|
+<body>
|
|
|
+ <style>
|
|
|
+ td {
|
|
|
+ padding: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ td,
|
|
|
+ th {
|
|
|
+ border: 1px solid #999;
|
|
|
+ border-top-color: rgb(153, 153, 153);
|
|
|
+ border-top-style: solid;
|
|
|
+ border-top-width: 1px;
|
|
|
+ border-right-color: rgb(153, 153, 153);
|
|
|
+ border-right-style: solid;
|
|
|
+ border-right-width: 1px;
|
|
|
+ border-bottom-color: rgb(153, 153, 153);
|
|
|
+ border-bottom-style: solid;
|
|
|
+ border-bottom-width: 1px;
|
|
|
+ border-left-color: rgb(153, 153, 153);
|
|
|
+ border-left-style: solid;
|
|
|
+ border-left-width: 1px;
|
|
|
+ border-image-source: initial;
|
|
|
+ border-image-slice: initial;
|
|
|
+ border-image-width: initial;
|
|
|
+ border-image-outset: initial;
|
|
|
+ border-image-repeat: initial;
|
|
|
+ }
|
|
|
+
|
|
|
+ td {
|
|
|
+ display: table-cell;
|
|
|
+ vertical-align: inherit;
|
|
|
+ }
|
|
|
+
|
|
|
+ table {
|
|
|
+ border-collapse: collapse;
|
|
|
+ text-indent: initial;
|
|
|
+ border-spacing: 2px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ arr = [];
|
|
|
+ for (let i = 0; i < 5; i++) {
|
|
|
+ arr[i] = [];
|
|
|
+ for (let j = 0; j < 5; j++) {
|
|
|
+ arr[i][j] = (i + 1) * (j + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let str = "<table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead>";
|
|
|
+ for (let arrEl of arr) { //цикл создает строки
|
|
|
+ //одна итерация цикла создает ОДНУ СТРОКУ
|
|
|
+ str += "<tr>";
|
|
|
+
|
|
|
+ for (let val of arrEl) { //цикл создает ЯЧЕЙКИ в ОДНОЙ СТРОКЕ
|
|
|
+ //одна итерация цикла создает ОДНУ ЯЧЕЙКУ
|
|
|
+ str += `<td>${val}</td>`;
|
|
|
+ }
|
|
|
+ str += "</tr>";
|
|
|
+
|
|
|
+ }
|
|
|
+ str += "</table>";
|
|
|
+ document.write(str);
|
|
|
+
|
|
|
+
|
|
|
+ </script>
|
|
|
+
|
|
|
+</body>
|