这就好比是“选择”,“未选中”动态设置的ASP的selectedIndex:下拉
动态我想成立“选择”之类
dropdown.selectedIndex = dropdown.Items.FindByText("selected");
如何要显示的选择组?请指导
这就好比是“选择”,“未选中”动态设置的ASP的selectedIndex:下拉
动态我想成立“选择”之类
dropdown.selectedIndex = dropdown.Items.FindByText("selected");
如何要显示的选择组?请指导
你几乎没有
dropdown.Items.FindByText("selected").Selected = true;
编辑
要做到这一点通过JavaScript您将通过下拉的option
元素必须循环。像这样的东西
function setIndexByText()
{
drp = document.myform.selectcontrol; //this would be your dropdown
str = "selected";
for (indx=0; indx < drp.options.length; indx++)
{
if (drp.options[indx].text == str)
{
drp.selectedIndex = indx;
}
}
}
我可以做到这一点的JavaScript? – MayureshP 2011-05-30 11:03:32