Hallo zusammen,
ich versuche zurzeit die Werte eines HTML-forms mit input type="range" direkt auszugeben. Bei einem range-Wert funktioniert es über "output". Ich brauche jedoch mind. 3 range-Eingaben im Formular und für die anderen inputs funktioniert es leider nicht.
Folgenden Code habe ich probiert:
Ich habe zudem versucht über Javascript den Wert direkt auszugeben. Jedoch auch ohne Erfolg:
Ich würde mich freuen wenn mir jemand erklären könnte wie ich den Wert direkt anzeigen lassen kann.
Vielen Dank im Voraus
ich versuche zurzeit die Werte eines HTML-forms mit input type="range" direkt auszugeben. Bei einem range-Wert funktioniert es über "output". Ich brauche jedoch mind. 3 range-Eingaben im Formular und für die anderen inputs funktioniert es leider nicht.
Folgenden Code habe ich probiert:
<!DOCTYPE html>
<html>
<head>
<title>RangeTest</title>
</head>
<body>
<meta charset="utf-8">
<form action="Request.php" method="post"
oninput="auswahl1Output.value=auswahl1.value", "auswahl2Output.value=auswahl2.value", "auswahl3Output.value=auswahl3.value"
>
welche Auswahl1?<br>
<input type="range" value="0" min="0" max="64"
name="auswahl1"><br>
Gewünschte Auswahl1 (max 64): <br> <output name="auswahl1Output" >0</output><br><br><br>
welche Auswahl2?<br>
<input type="range" value="0" min="0" max="48"
name="auswahl2"><br>
Gewünschte Auswahl2 (max. 4
: <br> <output name="auswahl2Output" >0</output><br><br><br>
Welche Auswahl3?<br>
<input type="range" value="0" min="0" max="50"
name="auswahl3"><br>
Gewünschte Auswahl3 (max 50): <br> <output name="auswahl3Output" >0</output><br><br><br>
<br>
<input type="submit" value="Bestätigen">
</form>
</body>
</html>
<html>
<head>
<title>RangeTest</title>
</head>
<body>
<meta charset="utf-8">
<form action="Request.php" method="post"
oninput="auswahl1Output.value=auswahl1.value", "auswahl2Output.value=auswahl2.value", "auswahl3Output.value=auswahl3.value"
>
welche Auswahl1?<br>
<input type="range" value="0" min="0" max="64"
name="auswahl1"><br>
Gewünschte Auswahl1 (max 64): <br> <output name="auswahl1Output" >0</output><br><br><br>
welche Auswahl2?<br>
<input type="range" value="0" min="0" max="48"
name="auswahl2"><br>
Gewünschte Auswahl2 (max. 4

Welche Auswahl3?<br>
<input type="range" value="0" min="0" max="50"
name="auswahl3"><br>
Gewünschte Auswahl3 (max 50): <br> <output name="auswahl3Output" >0</output><br><br><br>
<br>
<input type="submit" value="Bestätigen">
</form>
</body>
</html>
PHP-Code:
<!DOCTYPE html>
<html>
<head>
<title>Auswahl</title>
</head>
<body>
<meta charset="utf-8">
<form action="Request.php" method="post">
Welche Auswahl1?<br>
<input type="range" value="0" min="0" max="64"
name="auswahl1" id="auswahl1"><br>
Gewünschte Auswahl1: <br> <id="auswahl1Output"><br><br><br>
Welche Auswahl2?<br>
<input type="range" value="0" min="0" max="48"
name="auswahl2" id="auswahl2"> <br>
Gewünschte Auswahl2 : <br> <id="auswahl2Output"><br><br><br>
Welche Auswahl3?<br>
<input type="range" value="0" min="0" max="50"
name="auswahl3" id="auswahl3"><br>
Gewünschte Auswahl3: <br> <id="auswahl3Output"><br><br><br>
<br>
<input type="submit" value="Bestätigen">
</form>
<script type="text/javascript">
document.getElementById('auswahl1').onchange = function() {
document.getElementById('auswahl1Output').innerHTML = this.value;
}
document.getElementById('auswahl2').onchange = function() {
document.getElementById('auswahl2Output').innerHTML = this.value;
}
document.getElementById('auswahl3').onchange = function() {
document.getElementById('auswahl3Output').innerHTML = this.value;
}
</script>
</body>
</html>
Vielen Dank im Voraus
Kommentar