Advertisement
Kacper_Michalak

Zadania Egzamin

Apr 4th, 2022
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.71 KB | None | 0 0
  1. //ZAD 1
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <title>Document</title>
  9. </head>
  10. <body>
  11.     <h1>Oblicz koszt dostawy</h1> <br>
  12.     <input type="checkbox" id="chck">
  13.     <label for="chck">Jestem z Zielonej Góry </label> <br>
  14.     <p>albo</p>
  15.     Podaj ilość kilometrów
  16.     <input type="number" id="kilometry"><br>
  17.     <input type="button" id="oblicz" value="Oblicz"><br>
  18.     <p id="tak"></p>
  19.     <script>
  20.  
  21.         var chck = document.getElementById('chck');
  22.         var km = document.getElementById('kilometry');
  23.         var txt = document.getElementById('tak');
  24.         console.log(chck.value);
  25.  
  26.         var btn = document.getElementById('oblicz');
  27.         var kwota
  28.         btn.onclick =function () {
  29.            
  30.             if(chck.checked){
  31.                 txt.textContent = "Dowieziemy Twoją pizzę za darmo";
  32.    
  33.             }else{
  34.                
  35.                  kwota = 2 * km.value;  
  36.                  txt.textContent = "Dowóz będzie Cię kosztował " + kwota + " złotych";
  37.                
  38.             }
  39.         }
  40.            
  41.          
  42.        
  43.  
  44.     </script>
  45. </body>
  46. </html>
  47. //ZAD 2
  48. <!DOCTYPE html>
  49. <html lang="en">
  50. <head>
  51.     <meta charset="UTF-8">
  52.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  53.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  54.     <title>Document</title>
  55. </head>
  56. <body>
  57.     Rodzaj paliwa<br>
  58.     <input type="number" id="rodzaj" name="rodzaj"><br>
  59.     Ile litrów<br>
  60.     <input type="number" id="litry" name="litry"> <br>
  61.     <input type="button" id="oblicz" name="oblicz" value="Oblicz">
  62.     <p id="wynik" name="wynik"></p>
  63. </body>
  64. <script>
  65.     var r = document.getElementById('rodzaj');
  66.     var l = document.getElementById('litry');
  67.     var b = document.getElementById('oblicz');
  68.     var w = document.getElementById('wynik');
  69.     var koszt;
  70.      b.onclick = function(){
  71.         if(r.value == 1){
  72.             koszt = l.value * 4;
  73.         }else if(r.value == 2){
  74.             koszt = l.value * 3.5;
  75.         }
  76.         else{
  77.             koszt = 0;
  78.         }
  79.         w.textContent = "koszt paliwa: " + koszt + " zł";
  80.      }
  81. </script>
  82. </html>
  83. //ZAD 3
  84. <!DOCTYPE html>
  85. <html lang="en">
  86. <head>
  87.     <meta charset="UTF-8">
  88.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  89.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  90.     <title>Zad 3</title>
  91. </head>
  92. <body>
  93.     <section class="main">
  94.         Wybierz fryzure: <br/>
  95.         <input id="fryzura1" name="fryzura" type="radio">Krótkie <br/>
  96.         <input id="fryzura2" name="fryzura" type="radio">Średnie <br/>
  97.         <input id="fryzura3" name="fryzura" type="radio">Półdługie <br/>
  98.         <input id="fryzura4" name="fryzura" type="radio">Długie <br/>
  99.         <button onclick="oblicz()">OBLICZ</button>
  100.         <p id="wynik"></p>
  101.     </section>
  102. </body>
  103.  
  104.  
  105. <script>
  106.     function oblicz()
  107.     {
  108.         let cena;
  109.         let fryzura1=document.getElementById("fryzura1");
  110.         let fryzura2=document.getElementById("fryzura2");
  111.         let fryzura3=document.getElementById("fryzura3");
  112.         let fryzura4=document.getElementById("fryzura4");
  113.         let wynik=document.getElementById("wynik");
  114.  
  115.         let x="zl";
  116.         if (fryzura1.checked) {
  117.             cena=25;
  118.         } else if(fryzura2.checked) {
  119.             cena=30;
  120.         } else if(fryzura3.checked){
  121.             cena=40;
  122.         } else if (fryzura4.checked){
  123.             cena=50;
  124.         }
  125.         wynik.innerHTML="Cena strzyżenia: "+ cena+" zl";
  126.     }
  127.  
  128.     </script>
  129. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement