1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<!DOCTYPE html> <html> <head> <title>Zima 2018 5</title> <meta charset="utf-8"> </head> <body> <p id="komunikat"></p> <form> Podaj liczbę ogłoszeń <input type="number" id="ile"><br> <label>Policz upust na newsletter <input type="checkbox" id="zaz"></label><br> <button type="button" onclick="Oblicz()">Oblicz</button> </form> <script> function Oblicz() {var ile=document.getElementById('ile').value; if (document.getElementById('zaz').checked) { if(ile<50)document.getElementById('komunikat').innerHTML="Koszt ogłoszeń: "+(ile*1.8)+" Zł"; else document.getElementById('komunikat').innerHTML="Koszt ogłoszeń: "+(ile*0.8)+" Zł"; } else { if(ile<50)document.getElementById('komunikat').innerHTML="Koszt ogłoszeń: "+(ile*2)+" Zł"; else document.getElementById('komunikat').innerHTML="Koszt ogłoszeń: "+(ile)+" Zł"; } } </script> </body> </html> |