Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <title>Kawa</title>
- <body>
- <h1>Kawa</h1>
- <form>
- Ilosc kawy<input type="number" name="pierwsza"><br>
- Wybierz rodzaj kawy:
- <select name="kawa">
- <option value="5">arabica</option>
- <option value="7">rodzaj 2</option>
- <option value="6">rodzaj 3</option>
- </select>
- <input type="button" value="Oblicz" OnClick="Oblicz()"><br>
- <p id="wynik"></p>
- </form>
- <script>
- function Oblicz(){
- var a=document.forms[0].elements[0].value;
- var cena=document.forms[0].kawa.value;
- if(a<=0 || a==""){
- document.getElemnetById("wynik").innerHTML="Musisz podac liczbe dodatnia";
- return;
- }
- else{
- var w=a*cena;
- document.getElementById("wynik").innerHTML="cena kawy wynosi "+w;
- }
- }
- </script>
- </body>
- </head>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement