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> <script src="assets/calculator.js"></script>
</head> </head>
<body> <body>
<h1>Käfigrechner</h1> <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"> <div class="input-element">
<input type="range" min="1" max="20" value="4" class="slider" id="numRats"> <label for="numFullFloors">Vollebenen</label>
<label for="numRats">Anzahl an Ratten <div class="ncontainer">
<div id="outputNumRats"></div> <div class="input-group">
</label> <button onclick="decreaseFloorNum()">-</button>
<input type="text" id="numFullFloors" value="3" readonly>
<button onclick="increaseFloorNum()">+</button>
</div>
<div class="ncontainer"> </div>
<div class="input-group"> </div>
<button onclick="decreaseFloorNum()">-</button> <div class="container" id="resultsDiv">
<input type="text" id="numFullFloors" value="3" readonly> </div>
<button onclick="increaseFloorNum()">+</button>
</div> </div>
</div> </div>
<label for="numFullFloors">Vollebenen</label>
<div class="container" id="resultsDiv">
</div>
</div> </div>
<script> <script>
var outputFailedChecks = document.getElementById("failedChecks"); var labelNumRats = document.getElementById("labelNumRats");
var ratSlider = document.getElementById("numRats"); var ratSlider = document.getElementById("numRats");
var outputNumRats = document.getElementById("outputNumRats");
outputNumRats.innerHTML = ratSlider.value; labelNumRats.innerHTML = `Anzahl an Ratten: ` + ratSlider.value;
ratSlider.oninput = function () { ratSlider.oninput = function () {
outputNumRats.innerHTML = this.value; labelNumRats.innerHTML = `Anzahl an Ratten: ` + this.value;
update(); update();
} }
@ -51,7 +55,7 @@
function update() { function update() {
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorNum.value); var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorNum.value);
var resultsDiv = document.getElementById("resultsDiv"); 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'); const ul = document.createElement('ul');
for (const key in failed_checks) { for (const key in failed_checks) {
@ -61,7 +65,6 @@
} }
resultsDiv.appendChild(ul); resultsDiv.appendChild(ul);
outputFailedChecks.innerHTML = failed_checks;
} }