我有一个表单,需要三个输入范围供用户选择。
当我实现一个范围时,它工作得很好(见下文),但是当我添加第二个或第三个范围时,输出变量始终保持为 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>
关于javascript - 输入范围 每份表格仅限一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35280699/