You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.4 KiB
66 lines
1.4 KiB
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<meta name="description" content="">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<!-- Place favicon.ico in the root directory -->
|
|
<link rel="stylesheet" href="css/bootstrap.css">
|
|
<link rel="stylesheet" href="css/css.css">
|
|
<link rel="stylesheet" href="css/all.css">
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<form action="">
|
|
<input type="number"
|
|
id="množství"
|
|
class="mojecss"
|
|
style="border-color: brown;"
|
|
name="množství"
|
|
placeholder="zadej počet"
|
|
value="1">
|
|
<button id="přepočítat" type="button">Přepočítej</button>
|
|
<p>
|
|
cena: <span id="cena">8000</span>
|
|
</p>
|
|
<button type="submit">do košíku</button>
|
|
<i class="fab fa-accessible-icon"></i>
|
|
|
|
|
|
|
|
|
|
</form>
|
|
<script>
|
|
let puvodnicena = 8000;
|
|
|
|
function prepocet_ceny(){
|
|
let mno_ele = document.querySelector("#množství");
|
|
let celkem = mno_ele.value * puvodnicena;
|
|
let cena_ele = document.querySelector("#cena");
|
|
cena_ele.innerHTML = celkem;
|
|
|
|
|
|
|
|
}
|
|
prep_btn = document.querySelector("#přepočítat");
|
|
prep_btn.addEventListener("click", prepocet_ceny);
|
|
|
|
let mno_ele = document.querySelector("#množství");
|
|
mno_ele.addEventListener("change", prepocet_ceny);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|