在 Dojo 中以编程方式更新滑块
我有一个滑块,我喜欢通过输入字段更新滑块,我的意思是,如果我在输入字段中输入一个数字并按下按钮,滑块就会更新栏中的位置。
滑块的代码
<li id="sliderHolder" class="leftPaneliconS">
<div class="Slider" id="slider2"
data-dojo-type="dijit.form.VerticalSlider"
data-dojo-props='name:"vertical1",
onChange:function(val){ hidesubmenu();zoomCanvas(val); },
value:50,
maximum:100,
minimum:20,
pageIncrement:100,
intermediateChanges: true,
style:{height:"150px"} '>
<ol data-dojo-type="dijit.form.VerticalRuleLabels"
data-dojo-props='container:"leftDecoration", style:{width:"2em"}, labelStyle:"right:0px;"'>
<li></li>
<li></li>
</ol>
</div></li>
<input id="update" name="update" value=" ">
这是我正在尝试的
zoomvar=document.getElementsByName("vertical1");
zoomvar.value=newValue;
:但这不起作用。希望有人能帮助我
i have a slider and i like to update the slider through a input field, i mean if i put a number in a input field and press a button , the slider update the position in the bar.
this is the code of the slider
<li id="sliderHolder" class="leftPaneliconS">
<div class="Slider" id="slider2"
data-dojo-type="dijit.form.VerticalSlider"
data-dojo-props='name:"vertical1",
onChange:function(val){ hidesubmenu();zoomCanvas(val); },
value:50,
maximum:100,
minimum:20,
pageIncrement:100,
intermediateChanges: true,
style:{height:"150px"} '>
<ol data-dojo-type="dijit.form.VerticalRuleLabels"
data-dojo-props='container:"leftDecoration", style:{width:"2em"}, labelStyle:"right:0px;"'>
<li></li>
<li></li>
</ol>
</div></li>
<input id="update" name="update" value=" ">
i was trying this:
zoomvar=document.getElementsByName("vertical1");
zoomvar.value=newValue;
but that does not work. hope some can help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下:dijit.byId("slider2").set("value", yourValue);
另外,请确保您在滑块启动后调用它:)
try that : dijit.byId("slider2").set("value", yourValue);
Also, make sure you're calling that AFTER your slider has been started :)