fix: label

This commit is contained in:
moanos [he/him] 2024-07-18 23:43:57 +02:00
parent 5165ef485f
commit d51fb299e9

View File

@ -7,16 +7,18 @@
<script src="assets/calculator.js"></script>
</head>
<body>
<h1>Käfigrechner</h1>
<div class="content">
<div class="container-form">
<div class="input-element">
<div class="slidecontainer">
<label for="numRats" id="labelNumRats">Anzahl an Ratten ?</label>
<input type="range" min="1" max="20" value="4" class="slider" id="numRats">
<label for="numRats">Anzahl an Ratten
<div id="outputNumRats"></div>
</label>
</div>
<div class="input-element">
<label for="numFullFloors">Vollebenen</label>
<div class="ncontainer">
<div class="input-group">
<button onclick="decreaseFloorNum()">-</button>
@ -24,21 +26,23 @@
<button onclick="increaseFloorNum()">+</button>
</div>
</div>
<label for="numFullFloors">Vollebenen</label>
</div>
<div class="container" id="resultsDiv">
</div>
</div>
</div>
</div>
<script>
var outputFailedChecks = document.getElementById("failedChecks");
var labelNumRats = document.getElementById("labelNumRats");
var ratSlider = document.getElementById("numRats");
var outputNumRats = document.getElementById("outputNumRats");
outputNumRats.innerHTML = ratSlider.value;
labelNumRats.innerHTML = `Anzahl an Ratten: ` + ratSlider.value;
ratSlider.oninput = function () {
outputNumRats.innerHTML = this.value;
labelNumRats.innerHTML = `Anzahl an Ratten: ` + this.value;
update();
}
@ -51,7 +55,7 @@
function update() {
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorNum.value);
var resultsDiv = document.getElementById("resultsDiv");
resultsDiv.innerHTML = `<strong>Werte</strong>: ${savicSuiteRoyaleDim.toString()} n(rats): ${ratSlider.value}, n(floors): ${fullFloorNum.value}`;
resultsDiv.innerHTML = `<strong>Ergebnis</strong>`;
const ul = document.createElement('ul');
for (const key in failed_checks) {
@ -61,7 +65,6 @@
}
resultsDiv.appendChild(ul);
outputFailedChecks.innerHTML = failed_checks;
}