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,38 +7,42 @@
<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">
</div>
<div class="slidecontainer">
<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 class="ncontainer">
<div class="input-group">
<button onclick="decreaseFloorNum()">-</button>
<input type="text" id="numFullFloors" value="3" readonly>
<button onclick="increaseFloorNum()">+</button>
<div class="input-element">
<label for="numFullFloors">Vollebenen</label>
<div class="ncontainer">
<div class="input-group">
<button onclick="decreaseFloorNum()">-</button>
<input type="text" id="numFullFloors" value="3" readonly>
<button onclick="increaseFloorNum()">+</button>
</div>
</div>
</div>
<div class="container" id="resultsDiv">
</div>
</div>
</div>
<label for="numFullFloors">Vollebenen</label>
<div class="container" id="resultsDiv">
</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;
}