1 (edytowany przez kamil 10-11-2022 11:40:48)

Temat: EE.09-04-22.06-SG (prompt) - zadanie domowe

https://ti.dxe.pl/files2/egz/ee_09_2022 … _kolor.pdf

2 (edytowany przez kamil 08-12-2022 09:51:01)

Odp: EE.09-04-22.06-SG (prompt) - zadanie domowe

<script>
  function fun1(x)
  {
    var t1 = document.getElementById("t1");
    var t2 = document.getElementById("t2");
    var t3 = document.getElementById("t3");
    var t4 = document.getElementById("t4");
    //
    var p = prompt("Podaj ilość:", "");
    if (x == 1)
    {
      t1.innerHTML = p;
      if (p == 0) t1.style.background = "red";
      else if (p>=1 && p<=5) t1.style.background = "yellow";
      else t1.style.background = "Honeydew";
    }
    if (x == 2)
    {
      t2.innerHTML = p;
      if (p == 0) t2.style.background = "red";
      else if (p>=1 && p<=5) t2.style.background = "yellow";
      else t2.style.background = "Honeydew";
    }
    if (x == 3)
    {
      t3.innerHTML = p;
      if (p == 0) t3.style.background = "red";
      else if (p>=1 && p<=5) t3.style.background = "yellow";
      else t3.style.background = "Honeydew";
    }
    if (x == 4)
    {
      t4.innerHTML = p;
      if (p == 0) t4.style.background = "red";
      else if (p>=1 && p<=5) t4.style.background = "yellow";
      else t4.style.background = "Honeydew";
    }
  }
  function fun2(x)
  {
    var licznik = document.getElementById("licznik");
    licznik.value = parseInt(licznik.value)+1;
    if (x == 1) alert("Zamowienie nr: "+licznik.value+" Produkt: Skretka UTP drut");
    if (x == 2) alert("Zamowienie nr: "+licznik.value+" Produkt: Skretka UTP linka");
    if (x == 3) alert("Zamowienie nr: "+licznik.value+" Produkt: Wtyki 8P8C");
    if (x == 4) alert("Zamowienie nr: "+licznik.value+" Produkt: Modułu keystone");
  }
</script>
<body>
<hr>
<table border="1" width="50%">
  <tr>
    <td>Produkt</td>
    <td>Jednostka</td>
    <td>Dostępnośc</td>
    <td>Aktualizacja</td>
    <td>Zamówienie</td>
  </tr>
  <tr>
    <td>Skretka UTP drut</td>
    <td>metr</td>
    <td id="t1">0</td>
    <td><button onclick="fun1(1)">Aktualizuj</button></td>
    <td><button onclick="fun2(1)">Zamów</button></td>
  </tr>
  <tr>
    <td>Skretka UTP linka</td>
    <td>metr</td>
    <td id="t2">0</td>
    <td><button onclick="fun1(2)">Aktualizuj</button></td>
    <td><button onclick="fun2(2)">Zamów</button></td>
  </tr>
  <tr>
    <td>Wtyki 8P8C</td>
    <td>sztuki</td>
    <td id="t3">0</td>
    <td><button onclick="fun1(3)">Aktualizuj</button></td>
    <td><button onclick="fun2(3)">Zamów</button></td>
  </tr>
  <tr>
    <td>Modułu keystone</td>
    <td>sztuki</td>
    <td id="t4">0</td>
    <td><button onclick="fun1(4)">Aktualizuj</button></td>
    <td><button onclick="fun2(4)">Zamów</button></td>
  </tr>
</table>
<hr>
<form>
  <input type="hidden" id="licznik" value="0">
</form>