select下拉列表操作,如何兼容于IE和firefox
来源:互联网 发布:cpi数据查询 编辑:程序博客网 时间:2024/05/17 06:48
1.在为select 添加option时,如果用$('city').add(new Option(array[1],array[0])),只能兼容于ie;
2.删除 option 在 firefox 是 select.remove(selectedIndex),而不是 options.remove()
输出 option[x].innerText 在 firefox 下用 options[x].textContent(firefox没有innerText,就是用textContent 来替代的)
3.动态删除select中的所有options:
document.getElementById("ddlResourceType").options.length=0;
动态删除select中的某一项option:
var sObj=document.getElementById("ddlResourceType");
sObj.removeChild(sObj.options[indx]);
动态添加select中的项option:
document.getElementById("ddlResourceType").options.add(new Option(text,value));
2.删除 option 在 firefox 是 select.remove(selectedIndex),而不是 options.remove()
输出 option[x].innerText 在 firefox 下用 options[x].textContent(firefox没有innerText,就是用textContent 来替代的)
3.动态删除select中的所有options:
document.getElementById("ddlResourceType").options.length=0;
动态删除select中的某一项option:
var sObj=document.getElementById("ddlResourceType");
sObj.removeChild(sObj.options[indx]);
动态添加select中的项option:
document.getElementById("ddlResourceType").options.add(new Option(text,value));
上面在IE和FireFox都能测试成功,希望以后你可以用上。
- select下拉列表操作,如何兼容于IE和firefox
- 兼容IE和FIREFOX的select选项操作JS
- js操作select 兼容ie、chrome、Firefox
- JS对select动态添加options操作[IE&FireFox兼容]
- JS对select动态添加options操作[IE&FireFox兼容]
- JS对select动态添加options操作[IE&FireFox兼容]
- JS对select动态添加options操作[IE&FireFox兼容]
- JS对select动态添加options操作[IE&FireFox兼容]
- 兼容ie firefox select 下拉框 无限级联无刷新下拉框 纯javascript
- 向select中添加option,firefox和ie兼容
- 获取select标签的值 兼容IE和firefox
- select option隐藏(兼容IE,firefox)
- 兼容IE和firefox 操作XML的 javascript
- 如何获取事件触发源(兼容IE和FireFox)
- JS中如何传递Event对象,兼容IE和FireFox
- [js] 兼容IE和firefox
- showModelessDialog兼容firefox和ie
- FireFox和IE下的select option JS相关操作
- 读C程序设计第八章有感
- 学网络方向的该怎么学啊
- linux系统下获取IP地址
- java模式之单例模式(Singleton Pattern)
- A New Beginning
- select下拉列表操作,如何兼容于IE和firefox
- 用模拟器零成本体验MF开发
- 租房生活稳定了
- Zend Engine 幻想
- 华为oracle试题解答
- 域名设置问题
- 多线程安全的单例代码中,为何要两次判断是否为null
- asp.net控件开发基础(1)
- 什么是句柄