<!doctype html>
*{margin:0;padding:0; box-sizing:border-box; font-family:Verdana; }
#panel_lewy{float:left; width:45%; height:600px; background-color:#BAD2CF; padding: 15px;}
#panel_prawy{float:left; width:55%; height: 600px; background-color:#88AFAA; padding:15px;}
footer{clear:both; color:white;padding:10px;background-color:black; text-align:center;}
table, th,tr,td{border: 2px solid #88AFAA; margin-bottom:35px; text-align:center; border-collapse:collapse; margin: 0 auto;}
th{padding:5px; background-color:black; color:white;}
td{padding:5px;}
tr:nth-child(even) {background-color:#279e7c;}
tr:nth-child(odd) {background-color:#a24be5;}
#banner{background-color:black; color:white; text-align:center; padding:10px}
ol li{margin-left:15px}
h2{margin:15px 0;}
input[type=text] {margin:5px auto;}
input[type=button] {padding:5px; border-radius:5px; cursor:pointer; border:2px solid black; background-color:#88AFAA; color:black; padding:5px 25px; margin: 0 auto;}
function round(value, decimal){
return Number(Math.round(value + "e"+decimal)+"e-"+decimal);
}
<h1>Portal ogłoszeniowy
</h1>
<main>
<td rowspan="3">Subskrypcja newslettera to upust 0,20 PLN na ogłoszenie
</td>
<input type="number" id="liczba_ogłoszeń">
<input type="checkbox" id="subskrypcja"><br><br>
<input type="button" id="button" value="oblicz" onclick="oblicz()"><br><br>
var wynik_div = document.getElementById('wynik');
function oblicz(){
var liczba = document.getElementById("liczba_ogłoszeń").value;
var upust = document.getElementById("subskrypcja");
if(liczba >= 1 && liczba <= 10){
if(upust.checked){
var cena = (liczba*1)-(liczba*0.20);
}else{
var cena = liczba*1;
}
}else if(liczba>=11 && liczba <= 50){
if(upust.checked){
var cena = (liczba*0.80) - (liczba*0.20);
} else {
var cena = liczba*0.80;
}
}else {
if(upust.checked){
var cena = (liczba*0.60)-(liczba*0.20);
} else {
var cena= liczba*0.60;
}
}
wynik_div.innerHTML = Math.round(cena*100)/100;
}
</main>
© INCOGNITO
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}