Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ZAD 1
- <!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>
- <h1>Oblicz koszt dostawy</h1> <br>
- <input type="checkbox" id="chck">
- <label for="chck">Jestem z Zielonej Góry </label> <br>
- <p>albo</p>
- Podaj ilość kilometrów
- <input type="number" id="kilometry"><br>
- <input type="button" id="oblicz" value="Oblicz"><br>
- <p id="tak"></p>
- <script>
- var chck = document.getElementById('chck');
- var km = document.getElementById('kilometry');
- var txt = document.getElementById('tak');
- console.log(chck.value);
- var btn = document.getElementById('oblicz');
- var kwota
- btn.onclick =function () {
- if(chck.checked){
- txt.textContent = "Dowieziemy Twoją pizzę za darmo";
- }else{
- kwota = 2 * km.value;
- txt.textContent = "Dowóz będzie Cię kosztował " + kwota + " złotych";
- }
- }
- </script>
- </body>
- </html>
- //ZAD 2
- <!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>
- Rodzaj paliwa<br>
- <input type="number" id="rodzaj" name="rodzaj"><br>
- Ile litrów<br>
- <input type="number" id="litry" name="litry"> <br>
- <input type="button" id="oblicz" name="oblicz" value="Oblicz">
- <p id="wynik" name="wynik"></p>
- </body>
- <script>
- var r = document.getElementById('rodzaj');
- var l = document.getElementById('litry');
- var b = document.getElementById('oblicz');
- var w = document.getElementById('wynik');
- var koszt;
- b.onclick = function(){
- if(r.value == 1){
- koszt = l.value * 4;
- }else if(r.value == 2){
- koszt = l.value * 3.5;
- }
- else{
- koszt = 0;
- }
- w.textContent = "koszt paliwa: " + koszt + " zł";
- }
- </script>
- </html>
- //ZAD 3
- <!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>Zad 3</title>
- </head>
- <body>
- <section class="main">
- Wybierz fryzure: <br/>
- <input id="fryzura1" name="fryzura" type="radio">Krótkie <br/>
- <input id="fryzura2" name="fryzura" type="radio">Średnie <br/>
- <input id="fryzura3" name="fryzura" type="radio">Półdługie <br/>
- <input id="fryzura4" name="fryzura" type="radio">Długie <br/>
- <button onclick="oblicz()">OBLICZ</button>
- <p id="wynik"></p>
- </section>
- </body>
- <script>
- function oblicz()
- {
- let cena;
- let fryzura1=document.getElementById("fryzura1");
- let fryzura2=document.getElementById("fryzura2");
- let fryzura3=document.getElementById("fryzura3");
- let fryzura4=document.getElementById("fryzura4");
- let wynik=document.getElementById("wynik");
- let x="zl";
- if (fryzura1.checked) {
- cena=25;
- } else if(fryzura2.checked) {
- cena=30;
- } else if(fryzura3.checked){
- cena=40;
- } else if (fryzura4.checked){
- cena=50;
- }
- wynik.innerHTML="Cena strzyżenia: "+ cena+" zl";
- }
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement