我在上面的代码中使用了两个选择下拉菜单,并为两者都设置了值,并且需要显示两个地方不同的内容。请帮助我如何获得正确的结果,如果它显示为 div 或输入或按钮格式,我可以接受。
<input type="button" class="btn btn-sm btn-w1" name="txtval" id="txtval" onClick="checkVal()">
<select class="lbbg selsm-2 inblock-2 " name="rupeeitems" id="rupeeitems">
<option value="">Select</option>
<option value="RUB Dollar">RUB</option>
<option value="AFN Dinaar">AFN</option>
<option value="EUR Dollar">EUR</option>
</select>
<script>
var select = document.getElementById('rupeeitems');
var input = document.getElementById('txtval');
select.onchange = function () {
input.value = select.value;
}
</script>
<!-- This one is working properly -->
<input type="button" class="btn btn-sm btn-w1" name="txtprice" id="txtprice" onClick="checkPrice()">
<select class="lbbg selsm-2 inblock-2 " name="cmbitems" id="cmbitems">
<option value="">Select</option>
<option value="USD Dollar">USD</option>
<option value="Euro Dollar">EUR</option>
<option value="Aud Dollar">AUD</option>
<option value="Bahrien ">BHD</option>
</select>
<script>
var select = document.getElementById('cmbitems');
var input = document.getElementById('txtprice');
select.onchange = function () {
input.value = select.value;
}
</script>
泛舟湖上清波郎朗
回首忆惘然
慕容708150
相关分类