如何在更改期间获得输入范围

发布于 2025-02-02 13:53:32 字数 238 浏览 3 评论 0原文

我需要在Pyscript上获取我的脚本值。 我可以发送值,但我不查看实时更改,使用此代码y可以看到实时更改并通过更改事件来控制值。 “在此处输入图像描述”

I need to get values to my script on pyscript.
I can send values but I do not view live changes, with this code y can see the live changes and control the value by change event.enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼中杀气 2025-02-09 13:53:33

我解决了这个代码的问题
注意:它不能替换输入范围值的值
您可以使用'onChange =“ changefunction()”'获取值输入或需要如何获得值

<html>

<body>
  <h3>How to view range change value.</h3>
  <input type="range" id="myrange" value="50" min="0" max="500" oninput="document.getElementById('outputVal').innerHTML = this.value" />
  <label id="outputVal"></label>
</body>

</html>

My References
Demo
Doc

I solve my problem with this code
Note: It does not replace the value of the input range value
you can use 'onchange="changeFunction()"' for get value input or how you need to get value

<html>

<body>
  <h3>How to view range change value.</h3>
  <input type="range" id="myrange" value="50" min="0" max="500" oninput="document.getElementById('outputVal').innerHTML = this.value" />
  <label id="outputVal"></label>
</body>

</html>

My References
Demo
Doc

金橙橙 2025-02-09 13:53:32

您可以做的就是将onChange侦听器添加到每次更新值时运行功能的输入。然后,您可以访问新值并在需要时使用它们。

What you can do is add an onChange listener to the input which runs a function every time the value is updated. You can then access the new values and use them where needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文