![](/img/trans.png)
[英]Setting value of an input hidden field on .aspx page from a user control
[英]Setting input value when moving 'scroll control'
我一直在研究一个脚本,该脚本可让用户使用HTML5' <input type="range"
来设置设置,我已经开始使用它并可以在我的网站上显示一个值,但事实是,我希望将用户设置设置发布为表单输入$_POST['gearsdrag']
。
为了清楚起见,我提供了一个JSfiddle。
我要发送的<input id="r" type="text" name="gearsdrag" value="6000" />
是<input id="r" type="text" name="gearsdrag" value="6000" />
但是脚本集的内容是<input id="r" type="text" name="gearsdrag" />6000</input>
,并且没有与$_POST
一起发送。所以有办法做到这一点或者也许获取参数或其他内容。我无法弄清楚。
将函数更改为该值会将值插入输入中,然后您可以在那发布内容,这是您的后继内容吗?
<script>function showValue(newValue)
{
//changing the "innerHTML" to "value" is what inserts it into the text field
document.getElementById("r").value = newValue;
document.getElementById("rr").innerHTML = newValue;
}
</script>
Keisti pavarą prie: <span id="rr">0</span> / RPM
<form action="test.php" method="post">
<input type="range" min="0" max="7800" value="0" step="100" onchange="showValue(this.value)" />
<input id="r" type="text" name="gearsdrag" value=""/>
<input type="submit" value="Nustatyti" />
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.