每个表单的输入范围限制为一个

Input Range Limited to one per form

本文关键字:一个 表单 输入 范围      更新时间:2023-09-26

我有一个表单,我需要三个输入范围供用户选择。

当我实现一个范围时,

它工作得很好(见下文),但是当我添加第二个或第三个范围时,输出变量始终保持在 0。

如何在此表单中添加另外两个范围?

我的表单如下所示:

<form action='search.php' method='post' oninput='amount.value=rangeInput.value'>
<input type='range' id='rangeInput' name='satscore' min='0' max='2400'>
<output name='amount' for='rangeInput'>0</output>
<input type='submit' value='FILTER'>
</form>

如果没有看到您的完整代码,我想问题出在您如何命名范围和输入字段上。这应该有效:

<form action='search.php' method='post' oninput='amount1.value=rangeInput1.value; amount2.value=rangeInput2.value; amount3.value=rangeInput3.value;'>
<input type='range' id='rangeInput1' name='satscore1' min='0' max='2400' value="0">
<output name='amount1' for='rangeInput'>0</output>
<input type='range' id='rangeInput2' name='satscore2' min='0' max='2400' value="0">
<output name='amount2' for='rangeInput'>0</output>
<input type='range' id='rangeInput3' name='satscore3' min='0' max='2400' value="0">
<output name='amount3' for='rangeInput'>0</output>
<input type='submit' value='FILTER'>
</form>