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.
91 lines
4.5 KiB
91 lines
4.5 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Document</title>
|
|
<link rel="stylesheet" href="css/bootstrap.css">
|
|
</head>
|
|
<body class="d-flex flex-column min-vh-100">
|
|
<!-- navigační lištu -->
|
|
<div class="container">
|
|
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
|
|
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
|
|
<span class="fs-4">Bootstrap CSS+JS Procvičení</span>
|
|
</a>
|
|
<ul class="nav nav-pills">
|
|
<li class="nav-item"><a href="#" class="nav-link active" aria-current="page">Home</a></li>
|
|
<li class="nav-item"><a href="#" class="nav-link">Link 1</a></li>
|
|
<li class="nav-item"><a href="#" class="nav-link">Link 2</a></li>
|
|
<li class="nav-item"><a href="#" class="nav-link">Link 3</a></li>
|
|
</ul>
|
|
</header>
|
|
</div>
|
|
<!-- HLAVNÍ ČÁST KÓDU -->
|
|
<main class="container">
|
|
<h1 class="display-1 text-center">Kalkulačka</h1>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-10 offset-sm-1 text-center">
|
|
<form name="calc" action="" class="form-inline justify-content-center">
|
|
<input type="text" class="form-control" id="input_text">
|
|
|
|
<div class="text-center justify-content-center">
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('7')">7</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('8')">8</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('9')">9</button>
|
|
<button type="button" class="btn btn-secondary col-sm-2" onclick="addText('+')">+</button>
|
|
</div>
|
|
<div class="text-center justify-content-center">
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('4')">4</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('5')">5</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('6')">6</button>
|
|
<button type="button" class="btn btn-secondary col-sm-2" onclick="addText('-')">-</button>
|
|
</div>
|
|
<div class="text-center justify-content-center">
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('1')">1</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('2')">2</button>
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('3')">3</button>
|
|
<button type="button" class="btn btn-secondary col-sm-2" onclick="addText('*')">*</button>
|
|
</div>
|
|
<div class="text-center justify-content-center">
|
|
<button type="button" class="btn btn-primary col-sm-2" onclick="addText('0')">0</button>
|
|
<button type="button" class="btn btn-dark col-sm-2" onclick="addText('.')">.</button>
|
|
<button type="button" class="btn btn-outline-dark col-sm-2" onclick="calculate()">=</button>
|
|
<button type="button" class="btn btn-secondary col-sm-2" onclick="addText('/')">/</button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</main>
|
|
|
|
|
|
<!-- Footer - zakončení stránky -->
|
|
<footer class="footer mt-auto">
|
|
<ul class="nav justify-content-center border-bottom py-2 mb-3">
|
|
<li class="nav-item"><a href="#" class="nav-link text-muted">HOME</a></li>
|
|
<li class="nav-item"><a href="#" class="nav-link text-muted">Link1</a></li>
|
|
<li class="nav-item"><a href="#" class="nav-link text-muted">Link2</a></li>
|
|
</ul>
|
|
<p class="text-center text-muted">Škrabánek 2022</p>
|
|
</footer>
|
|
|
|
|
|
|
|
<script src="js/bootstrap.bundle.js"></script>
|
|
<script>
|
|
function calculate() {
|
|
// Zpracuje input, vypočítá obsah a vyhodí vysledek
|
|
document.calc.input_text.value = eval(document.calc.input_text.value);
|
|
}
|
|
|
|
function addText(txt) {
|
|
document.getElementById("input_text").value += txt;
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|