我试图在文本框中显示 slider 更改值的结果,但我不知道该怎么做。代码是:
JS
slider = widget.getByName("Slider1");
slider.addValueChangedHandler(
function (sender, e) {
alert(sender.getValue());
}
)
}
HTML
</head>
<body>
<div style="clear: both; margin-top: 0px; margin-bottom: 0px; "></div>
<div class="cell" style="height:100px">
<div class="container" style="height: 100px; margin-bottom: 0px;">
<div class="widget" style="height: 150px; margin-bottom: 0px;" id="root">
</div>
</div>
</div>
<div><input type="text" id="ValueBox" value="0"/></div>
</body>
</html>
提前感谢您的帮助。
最佳答案
脚本
slider = widget.getByName("Slider1");
slider.addValueChangedHandler(
function (sender, e) {
document.getElementById("ValueBox").value=sender.getValue();
}
)
}
</script>
HTML
</head>
<body>
<div style="clear: both; margin-top: 0px; margin-bottom: 0px; "></div>
<div class="cell" style="height:100px">
<div class="container" style="height: 100px; margin-bottom: 0px;">
<div class="widget" style="height: 150px; margin-bottom: 0px;" id="root">
</div>
</div>
</div>
<div><input type="text" id="ValueBox" value="0"/></div>
</body>
</html>
关于javascript - 如何在文本框中显示 slider 更改值的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34765738/