通过action传过来的值在option获取进行验证的方法:
for(var i=0;i<document.getElementById("ufacilityType").options.length;i++){
if(document.getElementById("ufacilityType").options[i].text==datas[0].facilityType){
document.getElementById("ufacilityType").options[i].selected=true;
break;
}
}
本文介绍了一种使用JavaScript来验证下拉菜单选项是否等于传入值的方法。通过对下拉菜单的每个选项进行迭代比较,如果找到匹配项,则将其设置为选中状态。
3565

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



