|
@@ -0,0 +1,41 @@
|
|
|
+// var table = document.createElement("table");
|
|
|
+
|
|
|
+// for (i = 0; i < 10; i++) {
|
|
|
+// var tr = document.createElement("tr");
|
|
|
+
|
|
|
+// for (j = 0; j < 10; j++) {
|
|
|
+// var td = document.createElement("td");
|
|
|
+// var val = i * j;
|
|
|
+// if (val === 0) {
|
|
|
+// val = i || j;
|
|
|
+// }
|
|
|
+
|
|
|
+// // td.onmouseover = function(){
|
|
|
+// // this.setAttribute("style", "background-color:black; color: white;");
|
|
|
+// // }
|
|
|
+// // td.onmouseout = function(){
|
|
|
+// // this.setAttribute("style", "background-color:null;");
|
|
|
+// // }
|
|
|
+
|
|
|
+// td.innerHTML = val;
|
|
|
+// tr.appendChild(td);
|
|
|
+// }
|
|
|
+// table.appendChild(tr);
|
|
|
+// }
|
|
|
+// document.body.appendChild(table);
|
|
|
+
|
|
|
+// var changeBg = (event, background, color) => {
|
|
|
+// var target = event.target;
|
|
|
+// if (target.tagName === "TD") {
|
|
|
+// target.style.background = background;
|
|
|
+// target.style.color = color;
|
|
|
+// target.parentNode.style.background = background;
|
|
|
+// target.parentNode.style.color = color;
|
|
|
+// var index = event.srcElement.cellIndex;
|
|
|
+// var tr = document.querySelectorAll("tr");
|
|
|
+// tr.forEach((tr) => (tr.childNodes[index].style.background = background));
|
|
|
+// tr.forEach((tr) => (tr.childNodes[index].style.color = color));
|
|
|
+// }
|
|
|
+// };
|
|
|
+// table.onmouseover = (event) => changeBg(event, "black", "white");
|
|
|
+// table.onmouseout = (event) => changeBg(event, "", "");
|