<small id='hgMfD'></small><noframes id='hgMfD'>

<tfoot id='hgMfD'></tfoot>

  1. <legend id='hgMfD'><style id='hgMfD'><dir id='hgMfD'><q id='hgMfD'></q></dir></style></legend>
    <i id='hgMfD'><tr id='hgMfD'><dt id='hgMfD'><q id='hgMfD'><span id='hgMfD'><b id='hgMfD'><form id='hgMfD'><ins id='hgMfD'></ins><ul id='hgMfD'></ul><sub id='hgMfD'></sub></form><legend id='hgMfD'></legend><bdo id='hgMfD'><pre id='hgMfD'><center id='hgMfD'></center></pre></bdo></b><th id='hgMfD'></th></span></q></dt></tr></i><div id='hgMfD'><tfoot id='hgMfD'></tfoot><dl id='hgMfD'><fieldset id='hgMfD'></fieldset></dl></div>

    • <bdo id='hgMfD'></bdo><ul id='hgMfD'></ul>

      如何检索和显示滑块范围值?

      时间:2024-04-19

        <legend id='oaXMg'><style id='oaXMg'><dir id='oaXMg'><q id='oaXMg'></q></dir></style></legend>

        <small id='oaXMg'></small><noframes id='oaXMg'>

        <tfoot id='oaXMg'></tfoot>

              <bdo id='oaXMg'></bdo><ul id='oaXMg'></ul>

            • <i id='oaXMg'><tr id='oaXMg'><dt id='oaXMg'><q id='oaXMg'><span id='oaXMg'><b id='oaXMg'><form id='oaXMg'><ins id='oaXMg'></ins><ul id='oaXMg'></ul><sub id='oaXMg'></sub></form><legend id='oaXMg'></legend><bdo id='oaXMg'><pre id='oaXMg'><center id='oaXMg'></center></pre></bdo></b><th id='oaXMg'></th></span></q></dt></tr></i><div id='oaXMg'><tfoot id='oaXMg'></tfoot><dl id='oaXMg'><fieldset id='oaXMg'></fieldset></dl></div>
                <tbody id='oaXMg'></tbody>

              • 本文介绍了如何检索和显示滑块范围值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何从输入范围中检索和显示滑块值?

                How can I retrieve and display the slider value from the input range?

                我正在使用 Meteor 并且更喜欢 javascript 代码.

                I am using Meteor and prefer javascript code.

                  <input id="slider" type="range" min="50" max="100" step="10" oninput="sliderChange(this.value)">
                
                  <output id="sliderVal"> </output>
                

                javascript;

                javascript;

                function sliderChange(val) {
                document.getElementById('sliderVal').innerHTML = val;
                }
                

                推荐答案

                引用后http://www.w3schools.com/jsref/event_oninput.asp看来您可以根据 oninput 的更改事件执行方法.

                After referencing http://www.w3schools.com/jsref/event_oninput.asp it seems you can execute a method upon the change event of oninput.

                以下代码检索并显示页面上的数字.

                The following code retrieves and displays the numbers on the page.

                <template name="myTemplate>
                 <input id="slider" type="range" min="50" max="100" step="10"  value="50">
                 <output id="output"></output>
                </template>
                

                client.js

                Template.myTemplate.rendered = function(){
                document.getElementById("slider").oninput = function() {
                    myFunction()
                };
                }
                
                function myFunction() {
                   var val = document.getElementById("slider").value //gets the oninput value
                   document.getElementById('output').innerHTML = val //displays this value to the html page
                   console.log(val)
                }
                

                流星方式:此外,您可以使用 change eventType 并按照您的意愿进行映射.这在输入更改状态时有效.

                THE METEOR WAY: Additionally, you may use the change eventType and map it how you want. This works when an input changes state.

                Template.yourTemplate.events({
                  'change input[type=range]': function(event){
                     var sliderValue = event.currentTarget.value
                     Session.set('sliderValueIs', sliderValue)
                     //then you can get this session and return it in a helper to display on your page
                  }
                })
                

                这篇关于如何检索和显示滑块范围值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:jQuery Slick Slider 过滤多个条件 下一篇:使用 Bokeh Slider 滑动图像

                相关文章

                <small id='5DzZ4'></small><noframes id='5DzZ4'>

                  <bdo id='5DzZ4'></bdo><ul id='5DzZ4'></ul>

              • <legend id='5DzZ4'><style id='5DzZ4'><dir id='5DzZ4'><q id='5DzZ4'></q></dir></style></legend>

                  1. <i id='5DzZ4'><tr id='5DzZ4'><dt id='5DzZ4'><q id='5DzZ4'><span id='5DzZ4'><b id='5DzZ4'><form id='5DzZ4'><ins id='5DzZ4'></ins><ul id='5DzZ4'></ul><sub id='5DzZ4'></sub></form><legend id='5DzZ4'></legend><bdo id='5DzZ4'><pre id='5DzZ4'><center id='5DzZ4'></center></pre></bdo></b><th id='5DzZ4'></th></span></q></dt></tr></i><div id='5DzZ4'><tfoot id='5DzZ4'></tfoot><dl id='5DzZ4'><fieldset id='5DzZ4'></fieldset></dl></div>

                    <tfoot id='5DzZ4'></tfoot>