<select id="slList" onchange="selectShow()">
<option value="100">A</option>
<option value="200">B</option>
<option value="300">C</option>
<option value="400">D</option>
</select>
<input type="text" id="txtShow" />
<script>
window.onload=selectShow;
function selectShow(){
document.getElementById("txtShow").value=document.getElementById("slList").value;
}
</script>初级之input与seelct功能二合一,
最新推荐文章于 2022-01-20 16:01:40 发布
本文展示了如何使用JavaScript实现下拉选择器与输入框之间的联动效果,当用户从选择器中选择选项时,输入框会同步显示所选选项的值。
15万+

被折叠的 条评论
为什么被折叠?



