JS 处理select下拉框信息总结
2013-05-15 15:52
295 查看
处理select信息:
var se = document.getElementById("select");
if(se.nodeName=='SELECT'){//判断标签
alert(se.options[se.selectedIndex].value);//获取value
alert(se.options[se.selectedIndex].text);//获取text
se.options.add(new Option("qw","12"));//添加选项
se.options.remove("qw");//删除选项
se.options[0].selected=true;//默认选中第一项
}
for(var i = 0;i<se.options.length;i++){
if(se.options[i].value==code){
se.options[i].selected=true;
break;
}
}
var se = document.getElementById("select");
if(se.nodeName=='SELECT'){//判断标签
alert(se.options[se.selectedIndex].value);//获取value
alert(se.options[se.selectedIndex].text);//获取text
se.options.add(new Option("qw","12"));//添加选项
se.options.remove("qw");//删除选项
se.options[0].selected=true;//默认选中第一项
}
for(var i = 0;i<se.options.length;i++){
if(se.options[i].value==code){
se.options[i].selected=true;
break;
}
}
相关文章推荐
- js处理select操作总结
- DWR util.js 整理(DWR 处理各种form表单Select/option,table等,List,Bean
- (转)基于MVC4+EasyUI的Web开发框架经验总结(6)--在页面中应用下拉列表的处理
- DIV+CSS+JS仿Select下拉表单网页特效源代码下载
- js操纵跨frame的三级联动select下拉选项
- qtp录制weblist select下拉列表的时候 遇到的问题总结
- Js下拉框树型选择控件(盖住select下拉框元素)
- js控制select下拉框--动态隐藏,展示option
- select 下拉选中后显示对应信息
- JS常用字符串处理方法应用总结
- js select 操作小总结
- JS获取下拉列表选中项的值和文本(select)以及获取单选按钮(radio)组的值和修改选中项
- js Select下拉列表框进行多选、移除、交换内容的具体实现方法
- js实现下拉框效果(select)
- Selenium之常见元素处理系列四--下拉列表-多选下拉列表元素信息
- Vue.js做select下拉列表的实例(ul-li标签仿select标签)
- js中json处理总结之JSON.parse
- js入门·表单元素(select下拉列表)制作二级联动菜单和网站导航
- 基于maven的spring boot项目 部署到tomcat出现js文件失效处理思路总结
- js中同步与异步处理的方法和区别总结