通过action传过来的值在option获取进行验证的方法
更新时间:2013年11月14日 15:12:30 作者:
通过action传过来的值在option获取进行验证,下面有个不错的示例,需要的朋友不要错过
通过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;
}
}
复制代码 代码如下:
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;
}
}
相关文章
JS 逻辑判断不要只知道用 if-else 和 switch条件判断(小技巧)
这篇文章主要介绍了JS 逻辑判断不要只知道用 if-else 和 switch,在一些逻辑复杂度的增加,代码中的 if/else 和 switch 会越来越臃肿。本文将带你尝试写出更优雅的判断逻辑,需要的朋友可以参考下2020-05-05
浅谈es6中export和export default的作用及区别
下面小编就为大家分享一篇浅谈es6中export和export default的作用及区别,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2018-02-02


最新评论