很多朋友习惯用oSelect.options[n].remove()这样的方法来删除下拉框内的选项,而且这样在IE里也能很好的使用,但是很不幸的是这个不是标准方法,是微软的IE实现的一个方法,在firefox等其他浏览器里就不能被支持。标准的方法是把oSelect.options.length值改变来删除options,但是这样的话就不好灵活的删除某一个option了,不过还是有变通的办法,就在删除前把要删除的option移动到最后一个,然后把整体的options.length --,就达到目的了,讲到这个偶有想起了数据结构那门课。 ? firefox method
对了,补充一点,options.add方法也不是标准方法,所以添加option用oSelect.options[oSelect.length] = option;这样的方法来添加才是跨浏览器的方法
document.getElementById("mySelect").remove(i)
详细解决方案
opentions remove的有关问题
热度:268 发布时间:2012-11-03 10:57:44.0
相关解决方案
- Session.Remove()为啥不起作用
- 关于Application.contents.Remove,请进来看看为啥不能用解决方法
- 怎么删除WebLogic 11g的域 How to remove the weblogic domain
- opentions remove的有关问题
- ExtJS4除了下拉框的光标(remove the cursor of combo)
- v.remove("Test0");有什么用?该怎么解决
- 关于list.remove(object)步骤的不解之处
- after() 跟 remove() 实现替换
- java.util.list remove()方法疑问,该怎么解决
- 泛型接口COLLECTION 中,remove(OBJECT element)方法的参数是OBJECT,add(T element),该如何处理
- DDK6001安装不了,总是提示 Remove: EULA解决办法
- 小弟我在工程里删除一个pbl时,提示:cannot remove main library! 怎么处理
- C#几种截取字符串的步骤(split 、Substring、Replace、remove)
- 安装mysql Install/Remove of the Service Denied!异常的解决方法
- jQuery`.parent()。remove()`不起作用
- jQuery 文档操作 - remove() 方法
- 安装mysql时出现 mysql Install/Remove of the Service Denied! 错误的解决办法
- D. Remove One Element(cf)dp
- LeetCode 27.Remove Element
- v.pop_back() “vs“ v.erase() “vs“ remove()
- source insight如何删除已加载的project, remove project,移除project,移除工程 出错,删除工程列表
- leetcode-83 Remove Duplicates from Sorted List
- mongodb remove.deletemany批量删除效率比较
- [Leetcode] Remove Nth Node From End of List
- [Leetcode] Remove Duplicates from Sorted List
- StringRedisTemplate 类下 redisTemplate.opsForList().remove(K var1, long var2, Object var4)用法
- leetcode-19-Remove Nth Node From End of List
- 如何web项目添加到tomcat中提示there are no resoureces that can be added or remove from the server
- 编译器调试---安装Android SDK遇到folders failed to rename or remove
- leetcode 随笔 Remove Duplicates from Sorted List Remove Duplicates from Sorted List II