首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

上拉框操作

2012-11-23 
下拉框操作//删除select里的所有内容document.getElementById(id).options.length0//动态删除select中的

下拉框操作

//删除select里的所有内容document.getElementById(id).options.length=0;  //动态删除select中的某一项optiondocument.getElementById(id).options.remove(indx); //设置默认选项document.getElementById(id)..selectedIndex = 0;//添加选项document.getElementById(id).options.add(new Option(text, value));//获取当前选中的值document.getElementById(id).value;//获取所有值的对象 为数组var Obj = new Array();Obj = document.getElementById(id).options;//得到select的当前选中项的text    var currSelectText = document.getElementById(id).options[document.getElementById(id).selectedIndex].text; 

?

热点排行