Browse Source

fix folders

serg155alternate 2 years ago
parent
commit
eb771c6630

+ 12 - 0
Class works/func/index.html

@@ -0,0 +1,12 @@
+<!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>
+    <script src="script.js"></script>
+</body>
+</html>

+ 15 - 0
Class works/func/script.js

@@ -0,0 +1,15 @@
+let arr1 = [1, 2, 3, 4, 5];
+
+function myFilter (arr, func) {
+    let result = [];
+    for (let item of arr){
+        if(func(item)){
+           result.push(item);
+        } 
+    }
+    console.log(result);
+    return result; 
+}
+
+myFilter(arr1, x => x<2);
+myFilter(['cold', 'wanna sleep'], confirm);

+ 16 - 0
Class works/index.html

@@ -0,0 +1,16 @@
+<!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>
+    <link rel="stylesheet" href="style.css">
+</head>
+<body>
+
+    <table class="root">
+    </table>
+    <script src="script.js"></script>
+</body>
+</html>

+ 144 - 0
Class works/script.js

@@ -0,0 +1,144 @@
+/* let body = {
+        tagName: 'body',
+        children: [{
+                tagName: 'div',
+                children: [{
+                        tagNAme: 'span',
+                        children: 'Enter a data please:'
+                    },
+                    {
+                        tagNAme: 'br'
+                    },
+                    {
+                        tagNAme: 'input',
+                        attributs: {
+                            type: 'text',
+                            id: 'text'
+                        }
+                    },
+                    {
+                        tagNAme: 'input',
+                        attributs: {
+                            type: 'text',
+                            id: 'surname'
+                        }
+                    }
+                ]},
+                {
+                    tagName: 'div',
+                    children: [{
+                            tagNAme: 'button',
+                            children: 'OK',
+                            attributs: {
+                                id: 'ok'
+                            }
+                        },
+                        {
+                            tagNAme: 'button',
+                            children: 'Cancel',
+                            attributs: {
+                                id: 'cancel'
+                            }
+                        }]
+
+                }
+
+            ]  
+        }
+
+        console.log(body.children[0].children[0].children);
+        console.log(body.children[1].children[1].attributs.id); */
+
+
+
+
+/* let root = document.querySelector('.root');
+
+for (let i = 0; i < 10; i++){
+
+    let tr = document.createElement('tr');
+    
+    root.append(tr);
+    
+    for (let k = 0; k < 10; k++){
+
+        let td = document.createElement('td');
+        
+        if (i === 0) {
+            td.innerText = k;
+            tr.append(td);
+        } else if (k === 0) {
+            td.innerText = i;
+            tr.append(td);
+        } else {
+            td.innerText = i * k;
+            tr.append(td);
+        }  
+    }
+}  */
+
+/* Подсветить ячейку над которой находится курсор мыши.
+ Используйте события mouseover и mouseout, 
+ и style.backgroundColor для подсветки.
+ */
+
+/* let td = document.querySelectorAll('td');
+
+td.forEach((i) => {
+    i.onmouseover = () => i.style.backgroundColor = 'yellow';
+    i.onmouseout = () => i.style.backgroundColor = '';
+}) */
+/* 
+Подсветить строку и столбец,
+в которой находится подсвеченная ячейка. Используйте parentElement (родительский элемент элемента DOM), и список его детей: children.
+Читкоды:
+в обработчик события в качестве this передается элемент, на котором событие произошло;
+у td есть свойство cellIndex, в котором лежит номер ячейки;
+у tr, аналогично есть свойство rowIndex - номер строки; */
+
+
+
+/* td.forEach((item, i) => {
+    item.onmouseover = () => {
+       item.style.backgroundColor = 'yellow'; 
+       item.parentNode.style.backgroundColor = 'green';
+       console.log(item.cellIndex);
+       console.log(i);
+       
+    } 
+
+    item.onmouseout = () => {
+        item.style.backgroundColor = '';
+        item.parentNode.style.backgroundColor = '';
+    }
+}) */
+
+
+let str = '<table>';
+
+for (let i = 1; i < 10; i++) {
+    str +='<tr>';
+    for (let j = 1; j < 10; j++){ 
+        str +=`<td> ${j * i} </td>`;
+    }
+    str +='</tr>';
+}
+str +='</table>';
+console.log(str);
+document.write(str);
+
+
+
+let arr = [1, 2, 3, 4];
+
+/* let sum = 0;
+for (let el of arr) {
+    sum += el;
+}
+arr.push(sum);
+console.log(arr); */
+
+let arrsum = arr.reduce((summ, acc) =>  summ + acc);
+arr.push(arrsum);
+console.log(arr);
+

+ 10 - 0
Class works/style.css

@@ -0,0 +1,10 @@
+td {
+    border-style: ridge;
+    width: 40px;
+    height: 40px;
+    text-align: center;
+    vertical-align: middle;
+ }
+ tr:nth-child(2n + 1) {
+    background-color: rgb(223, 227, 235);
+ }

+ 19 - 0
HW10/index.html

@@ -0,0 +1,19 @@
+<!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>HW2</title>
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div class="container">
+       
+    </div>
+    <script src="script.js"></script>
+</body>
+
+</html>

+ 0 - 0
HW10/script.js


HW5/style.css → HW10/style.css


HW4/index.html → HW4 Associative arrays/index.html


HW4/script.js → HW4 Associative arrays/script.js


HW4/style.css → HW4 Associative arrays/style.css


HW5/index.html → HW5 Structures/index.html


+ 0 - 1
HW5/script.js

@@ -1,5 +1,4 @@
 //ДЗ: Вложенные декларативные структуры и код в них. Отображение циклических и древовидных структур. Циклы.
-
 //html tree
 
 let body = {

HW6/style.css → HW5 Structures/style.css


HW6/index.html → HW6 Functions and scopes/index.html


HW6/script.js → HW6 Functions and scopes/script.js


HW8/style.css → HW6 Functions and scopes/style.css


HW7/index.html → HW7 Home Base/index.html


HW7/script.js → HW7 Home Base/script.js


HW7/style.css → HW7 Home Base/style.css


HW8/index.html → HW8 Functioms 2/index.html


+ 1 - 1
HW8/script.js

@@ -25,7 +25,7 @@ function sort(array, sortString, bool = 'true') {
             if (b[sortString] < a[sortString]) {
               return -1;
             }
-            return 0;
+              return 0;
           });
     }
     return array;

+ 10 - 0
HW8 Functioms 2/style.css

@@ -0,0 +1,10 @@
+*, html {
+    margin: 0;
+    padding: 0;
+}
+.container {
+    position: relative;
+    max-width: 1140px;
+    margin: 0 auto;
+    padding: 50px;
+}

+ 19 - 0
HW9/index.html

@@ -0,0 +1,19 @@
+<!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>HW2</title>
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div class="container">
+       
+    </div>
+    <script src="script.js"></script>
+</body>
+
+</html>

+ 0 - 0
HW9/script.js


+ 10 - 0
HW9/style.css

@@ -0,0 +1,10 @@
+*, html {
+    margin: 0;
+    padding: 0;
+}
+.container {
+    position: relative;
+    max-width: 1140px;
+    margin: 0 auto;
+    padding: 50px;
+}