<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>

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

      How can I retrieve and display slider range value?(如何检索和显示滑块范围值?)

        <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
                  }
                })
                

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

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)
                getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社

                <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>

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