将option添加到select框
2016-07-13 18:02
253 查看
var select=document.createElement("select"); select.setAttribute("class","field size2"); // 从隐藏的选择框里找选项 var hideSelect=document.getElementById("hideSelect"); for(var i=0;i<hideSelect.options.length;i++){ var op=document.createElement("option"); op.appendChild(document.createTextNode(hideSelect.options[i].text));// 设置文字 op.setAttribute("value",hideSelect.options[i].value);// 设置值 if(descId==hideSelect.options[i].value){ op.selected = true;// 设置是否选中 } select.appendChild(op);// 将option添加到select框 }
相关文章推荐
- Linux命令(14)文件和文件夹权限管理:chmod
- Linux 技巧:让进程在后台可靠运行的几种方法
- 初识OpenCV(基础篇)
- CentOS基础命令使用技巧-1
- DSM -- 进入linux文件系统
- jenkins结合ansible用shell实现自动化部署和回滚
- 使用nginx-rtmp搭建视频直播服务器
- SELinux 基本操作命令
- OpenSSLRSA.h
- log4j.properties配置详解
- Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at
- 详解Nginx中基本的内存池初始化配置
- 第7章 Linux档案与目录管理
- mahout推荐系统源码笔记(6) ---补充之mahout抽样
- Linux QT环境的搭建
- hadoop中常见元素的解释
- Linux设备驱动之字符设备(三)
- Android telephony架构 博客链接
- hadoop集群数据迁移
- hive hive.optimize.ppd=false导致map数量很大