对于下拉选择反映与其他下拉列表相同 [英] For the dropdown selection reflect the same to other dropdown
本文介绍了对于下拉选择反映与其他下拉列表相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个相同内容的下拉列表,通过选择一个下拉列表,我希望在其他下拉列表中反映出来。
在下拉列表中我有复选框选择。
对于文本框,我确实喜欢
Hi,
I have two dropdowns with same content, by selection of one dropdown I want to reflect same in other dropdown.
In dropdown again I have checkbox selection.
For textbox I did like
text_id_1 = document.getElementById("text_id_1");
text_id_2 = document.getElementById("text_id_2");
text_id_2.value = text_id_1.value;
如何进行下拉列表。
Plz建议我。
How to do for dropdown list.
Plz suggest me.
推荐答案
在dropdown1的SelectedIndexChanged事件中,将dropdown2的SelectedIndex设置为dropdown1的SelectedIndex。
In SelectedIndexChanged event of dropdown1, set the SelectedIndex of dropdown2 to SelectedIndex of dropdown1.
void dropdown1_SelectedIndexChanged(object sender, EventArgs e)
{
dropdown2.SelectedIndex = dropdown1.SelectedIndex;
}
尝试:
Try:
function SelectCorrespondinValue()
{
var dropdownlisttwo = document.getElementById("DropDownListTwo");
var e = document.getElementById("dropdownlistone");
var selectedValue = e.options[e.selectedIndex].text;
for(var i = 0; i < dropdownlisttwo.length -1; i++)
{
if(selectedValue == dropdownlisttwo.options[i].text)
{
dropdownlisttwo.selectedIndex = i;
}
}
}
在第一个DropdownList的更改事件中调用此函数。如果有帮助,请告诉我。
Call this function on "change" event of your first DropdownList. Let me know if it helps.
这篇关于对于下拉选择反映与其他下拉列表相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文