12345678910111213141516171819202122232425262728293031323334353637 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
-
- </body>
- <script>
- let table = document.createElement("table");
- for (let i = 1; i < 10; i++){
- let tr = document.createElement("tr");
- for (let a = 1; a < 10; a++){
- let td = document.createElement("td");
- td.innerText = a * i;
- td.style.border = '2px solid #d3d3d3'
- td.style.padding = '20px'
- td.style.fontSize = '20px'
- td.style.textAlign = 'center'
- tr.appendChild(td);
- td.onmouseover = function(){
- this.style.backgroundColor = "red"
- }
- td.onmouseout = function () {
- this.style.backgroundColor = 'white'
- }
- }
- table.appendChild(tr)
- }
- document.body.appendChild(table);
-
-
- </script>
- </html>
|