1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <script src="main.js"></script>
- </head>
- <body>
- <style>
- .table {
- padding: 15px;
- border: 1px solid #e9c6c6;
- border-radius: 4px;
- color: #4e4339;
- background-color: #f8ffcd;
- text-align: center;
- }
- .td{
- height: 25px;
- width: 25px;
- text-align: center;
- }
- </style>
- <script>
- let table = document.createElement('table');
- table.setAttribute('border','1')
- table.className = "table";
-
- document.body.append(table)
- table.setAttribute("align", "center");
- for(let y = 0; y<10;y++){
- let tr = document.createElement('tr')
- table.append(tr)
- for(let x = 0; x<10;x++){
- let td = document.createElement('td')
- table.append(td)
- let temp = x*y;
- if(x===0){
- temp = y
- }
- else if( y===0){
- temp = x
- }
- td.innerText = temp
- td.className = "td";
- // td.onmousemove = function () {
- // this.style.background = "yellow";
- // }
- // td.onmouseout = function () {
- // this.style.background = "none";
- // }
- // td.onmousemove = function () {
- // for (let item of this.parentElement.children) {
- // item.style.background = "yellowgreen";
- // }
- // for (let item of this.parentElement.parentElement.children) {
- // for (let item2 of item.children) {
- // if (item2.cellIndex === this.cellIndex) {
- // item2.style.background = "yellowgreen";
- // }
- // }
- // }
- // }
- // td.onmouseout = function () {
- // for (let item of this.parentElement.children) {
- // item.style.background = "none";
- // }
- // for (let item of this.parentElement.parentElement.children) {
- // for (let item2 of item.children) {
- // if (item2.cellIndex === this.cellIndex) {
- // item2.style.background = "none";
- // }
- // }
- // }
- // }
- //ХЗ ЧЕГО НЕ РАБОТАЕТ
- }
- }
- </script>
-
- </body>
- </html>
|