在下拉列表里添加新的选项
collegeObj.options[0]=new Option('请选择专业','0');
if (clg!=null){
for (var i = 1;i<=clg.length;i++){
collegeObj.options[i]=new Option(clg[i-1]['name'],clg[i-1]['id']);
}
}
删除下拉列表的所有选项function clearSelect(list){
if (typeof(s) == "string"){
list = document.getElementById(list);
}
if (list==null) return;
while (list.options.length > 0)
{
list.options[0] = null;
}
}
动态修改下拉列表的内容(代码片段)
最新推荐文章于 2024-07-13 15:17:36 发布