Browse Source

HW<04> done

GennadyBerg 2 years ago
parent
commit
0d2ce83868
10 changed files with 170 additions and 0 deletions
  1. 11 0
      js/04/home04_1.html
  2. 14 0
      js/04/home04_10.html
  3. 14 0
      js/04/home04_2.html
  4. 16 0
      js/04/home04_3.html
  5. 14 0
      js/04/home04_4.html
  6. 14 0
      js/04/home04_5.html
  7. 31 0
      js/04/home04_6.html
  8. 17 0
      js/04/home04_7.html
  9. 19 0
      js/04/home04_8.html
  10. 20 0
      js/04/home04_9.html

+ 11 - 0
js/04/home04_1.html

@@ -0,0 +1,11 @@
+<head>
+    <h1>greeting</h1>
+</head>
+
+<body>
+    <script>
+        let name = prompt("What`s Your name?");
+        let hello = "Hello, "
+        alert(hello + name);
+    </script>
+</body>

+ 14 - 0
js/04/home04_10.html

@@ -0,0 +1,14 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>New Line</h1>
+        </head>
+
+<body>
+    <script>
+        alert(prompt("Enter multiline string with '\\n' as new line.").split("\\n").join("\n"));
+    </script>
+</body>
+</h1>
+</head>

+ 14 - 0
js/04/home04_2.html

@@ -0,0 +1,14 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>gopni4ek</h1>
+        </head>
+
+<body>
+    <script>
+        alert(prompt("write please any words...").split(',').join("блин,"));
+    </script>
+</body>
+</h1>
+</head>

+ 16 - 0
js/04/home04_3.html

@@ -0,0 +1,16 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>Capitalize</h1>
+        </head>
+
+<body>
+    <script>
+        let str = prompt("Enter a string").toLowerCase();
+        str = str[0].toUpperCase() + str.slice(1);
+        alert(str);
+    </script>
+</body>
+</h1>
+</head>

+ 14 - 0
js/04/home04_4.html

@@ -0,0 +1,14 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>Word Count</h1>
+        </head>
+
+<body>
+    <script>
+        alert(prompt("Enter a string").split(' ').length);
+    </script>
+</body>
+</h1>
+</head>

+ 14 - 0
js/04/home04_5.html

@@ -0,0 +1,14 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>canberra</h1>
+        </head>
+
+<body>
+    <script>
+       
+    </script>
+</body>
+</h1>
+</head>

+ 31 - 0
js/04/home04_6.html

@@ -0,0 +1,31 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>Full Name</h1>
+        </head>
+
+<body>
+    <script>
+        let sName = prompt("Enter surname").toLowerCase().trim();
+        sName = sName[0].toUpperCase() + sName.slice(1);
+        let name = prompt("Enter name").toLowerCase().trim();
+        name = name[0].toUpperCase() + name.slice(1);
+        let fatherName = prompt("Enter father name").toLowerCase().trim();
+        fatherName = fatherName[0].toUpperCase() + fatherName.slice(1);
+        let fullName = sName + ' ' + name + ' ' + fatherName;
+        alert(fullName);
+
+        /*sname = getName("surname");
+        name = getName("name");
+        fatherName = getName("father name");
+
+        function getName(nameType){
+            let sName = prompt("Enter " + nameType).toLowerCase().trim();
+            sName = sName[0].toUpperCase() + sName.slice(1);
+            return sName;
+        }*/
+    </script>
+</body>
+</h1>
+</head>

+ 17 - 0
js/04/home04_7.html

@@ -0,0 +1,17 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>Beer</h1>
+        </head>
+
+<body>
+    <script>
+        let str = "Было жарко. Василий пил пиво вприкуску с креветками";
+        pivo = "пиво";
+        indexPivo = str.indexOf(pivo);
+        alert(str.slice(0, indexPivo) + "чай" + str.slice(indexPivo + pivo.length));
+    </script>
+</body>
+</h1>
+</head>

+ 19 - 0
js/04/home04_8.html

@@ -0,0 +1,19 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>no tag</h1>
+        </head>
+
+<body>
+    <script>
+        let str = "какой-то текст в котором есть один тэг <br /> и всякое другое"
+        tagOpen = "<";
+        tagClose = ">";
+        indextagOpen = str.indexOf(tagOpen);
+        indextagClose = str.indexOf(tagClose);
+        alert(str.slice(0, indextagOpen) + str.slice(indextagClose+1));
+    </script>
+</body>
+</h1>
+</head>

+ 20 - 0
js/04/home04_9.html

@@ -0,0 +1,20 @@
+<head>
+    <h1>
+
+        <head>
+            <h1>big tag</h1>
+        </head>
+
+<body>
+    <script>
+        let str = "какой-то текст в котором есть один тэг <br /> и всякое другое"
+        tagOpen = "<";
+        tagClose = ">";
+        indextagOpen = str.indexOf(tagOpen);
+        indextagClose = str.indexOf(tagClose);
+        let tag = str.slice(indextagOpen, indextagClose + 1).toLocaleUpperCase();
+        alert(str.slice(0, indextagOpen) + tag + str.slice(indextagClose + 1));
+    </script>
+</body>
+</h1>
+</head>