Pavel il y a 7 ans
Parent
commit
8f05e36f3a

+ 11 - 0
js07/MultiplytTable1/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+</head>
+<body>
+	
+	<script src="js/main.js"></script>
+</body>
+</html>

+ 20 - 0
js07/MultiplytTable1/js/main.js

@@ -0,0 +1,20 @@
+var table = document.createElement("table");
+
+table.setAttribute("cellpadding","15");
+table.setAttribute("border", "1");
+table.style.borderCollapse = "collapse";
+table.style.borderColor = "#ccc";
+document.body.appendChild(table);
+for (var i = 0; i < 9; i++) {
+	table.appendChild(document.createElement("tr"));
+	for (var j = 0; j < 9; j++) {
+		table.children[i].appendChild(document.createElement("td"));
+		table.children[i].children[j].innerHTML = (i + 1) * (j + 1);
+		
+	}
+
+}
+var c = table.querySelectorAll("tr:nth-child(2n)");
+for (var i = 0; i < c.length; i++) {
+	c[i].style.backgroundColor = "#efefef";
+}

+ 11 - 0
js07/MultiplytTable2/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+</head>
+<body>
+	
+	<script src="js/main.js"></script>
+</body>
+</html>

+ 24 - 0
js07/MultiplytTable2/js/main.js

@@ -0,0 +1,24 @@
+var table = document.createElement("table");
+
+table.setAttribute("cellpadding","15");
+table.setAttribute("border", "1");
+table.style.borderCollapse = "collapse";
+table.style.borderColor = "#ccc";
+document.body.appendChild(table);
+for (var i = 0; i < 9; i++) {
+	table.appendChild(document.createElement("tr"));
+	for (var j = 0; j < 9; j++) {
+		table.children[i].appendChild(document.createElement("td"));
+		table.children[i].children[j].innerHTML = (i + 1) * (j + 1);
+		table.children[i].children[j].onmouseover = colorFuncOn;
+		table.children[i].children[j].onmouseout = colorFuncOut;
+	}
+
+}
+
+function colorFuncOn(){
+    this.style.backgroundColor = "#ccc";
+}
+function colorFuncOut(){
+    this.style.backgroundColor = "#fff";
+}

+ 11 - 0
js07/MultiplytTable3/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+</head>
+<body>
+	
+	<script src="js/main.js"></script>
+</body>
+</html>

+ 39 - 0
js07/MultiplytTable3/js/main.js

@@ -0,0 +1,39 @@
+var table = document.createElement("table");
+
+table.setAttribute("cellpadding","15");
+table.setAttribute("border", "1");
+table.style.borderCollapse = "collapse";
+table.style.borderColor = "#ccc";
+document.body.appendChild(table);
+for (var i = 0; i < 9; i++) {
+	table.appendChild(document.createElement("tr"));
+	for (var j = 0; j < 9; j++) {
+		table.children[i].appendChild(document.createElement("td"));
+		table.children[i].children[j].innerHTML = (i + 1) * (j + 1);
+		table.children[i].children[j].onmouseover = colorFuncOn;
+		table.children[i].children[j].onmouseout = colorFuncOut;
+		table.children[i].children[j].setAttribute("name",j)
+	}
+
+}
+
+function colorFuncOn(){
+    
+    var i = this.getAttribute("name");
+    for (var j = 0; j < 9; j++) {
+    	this.parentNode.parentNode.childNodes[j].childNodes[i].style.backgroundColor= "#ccc";
+    }
+    for (var k = 0; k < 9; k++) {
+    	 this.parentNode.childNodes[k].style.backgroundColor = "#ccc";
+    }
+}
+function colorFuncOut(){
+   
+    var i = this.getAttribute("name");
+    for (var j = 0; j < 9; j++) {
+    	this.parentNode.parentNode.childNodes[j].childNodes[i].style.backgroundColor= "#fff";
+    }
+     for (var k = 0; k < 9; k++) {
+    	 this.parentNode.childNodes[k].style.backgroundColor = "#fff";
+    }
+}

+ 3 - 3
js07/js07.md

@@ -1,14 +1,14 @@
 ### Таблица умножения
 
-ссылка
+http://homework.pavelefimen95.fe.a-level.com.ua/MultiplytTable1
 
 ### Подсветить ячейку
 
-ссылка
+http://homework.pavelefimen95.fe.a-level.com.ua/MultiplytTable2
 
 ### Подсветить строку и столбец
 
-ссылка
+http://homework.pavelefimen95.fe.a-level.com.ua/MultiplytTable3
 
 ### makeProfileTimer