Browse Source

HW<3> done

Andrey 1 year ago
parent
commit
a73a76a3e0
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Dz3 js/Dz3js.html

+ 6 - 2
Dz3 js/Dz3js.html

@@ -72,14 +72,18 @@
 
             case "switch: if":
                 let color = prompt("Введите цвет", "");
-                if ((color == "red") || (color == "black")) {
+                if (color == "red")  {
                     document.write("<div style='background-color: red;'>красный</div>")
                     document.write("<div style='background-color: black; color: white;'>черный</div>");
+                }else if  (color == "black"){
+                    document.write("<div style='background-color: black; color: white;'>черный</div>");
                 }
 
-                else if ((color == "blue") || (color == "green")) {
+                else if (color == "blue")  {
                     document.write("<div style='background-color: blue;'>синий</div>");
                     document.write("<div style='background-color: green;'>зеленый</div>");
+                }else if (color == "green") {
+                    document.write("<div style='background-color: green;'>зеленый</div>");
                 }
 
                 else {