IE6 select的option的disabled属性没有效果及解决方案
来源:互联网 发布:中国服装存货数据分析 编辑:程序博客网 时间:2024/04/27 23:44
今天遇到了这个问题 ,Mark下
解決ie6,ie7的select option disabled沒有作用的問題 Select, Option, Disabled And The JavaScript Solution In IE7, IE6, IE5.5
解決方案:
http://www.lattimore.id.au/2005/07/01/select-option-disabled-and-the-javascript-solution/
下載js檔, 並include到頁面即可, 作法是把頁面的select element找出來, 判斷有disabled的option就變顏色且不可選擇
http://www.lattimore.id.au/files/examples/select-option-disabled-emulation.js
因為只有在ie7以下的版本有問題, 其他瀏覽器沒問題, 所以我改寫了一下
http://www.lattimore.id.au/2005/07/01/select-option-disabled-and-the-javascript-solution/
下載js檔, 並include到頁面即可, 作法是把頁面的select element找出來, 判斷有disabled的option就變顏色且不可選擇
http://www.lattimore.id.au/files/examples/select-option-disabled-emulation.js
因為只有在ie7以下的版本有問題, 其他瀏覽器沒問題, 所以我改寫了一下
if (navigator.appVersion.indexOf("MSIE 5.5") >= 0 || navigator.appVersion.indexOf("MSIE 6.0") >= 0 || navigator.appVersion.indexOf("MSIE 7.0") >= 0)
{
window.onload = ReloadSelectElement;
}
function ReloadSelectElement() {
if (document.getElementsByTagName) {
var s = document.getElementsByTagName("select");
if (s.length > 0) {
window.select_current = new Array();
for (var i=0, select; select = s[i]; i++) {
select.onfocus = function(){ window.select_current[this.id] = this.selectedIndex; }
select.onchange = function(){ restore(this); }
emulate(select);
}
}
}
}
function restore(e) {
if (e.options[e.selectedIndex].disabled) {
e.selectedIndex = window.select_current[e.id];
}
}
function emulate(e) {
for (var i=0, option; option = e.options[i]; i++) {
if (option.disabled) {
option.style.color = "graytext";
}
else {
option.style.color = "menutext";
}
}
}
- IE6 select的option的disabled属性没有效果及解决方案
- IE6中select标签的option不能disabled的解决方案
- IE6中select标签的option不能disabled的解决方案
- 更改select内option的属性
- select-option的属性与值得获取
- 对于不符合W3C标准的disabled属性的使用在Firefox、google等浏览器下没有效果的处理
- HTML中Select不用Disabled实现ReadOnly的效果
- select标签下option标签里value属性有什么用以及和text的区别
- AutoComplete没有效果的解决方案
- jQuery找出所有没有disabled属性的checkbox
- checkbox的disabled属性
- html的disabled属性
- 通过隐藏option实现select的联动效果
- 通过隐藏option实现select的联动效果
- 通过隐藏option实现select的联动效果
- 通过隐藏option实现select的联动效果
- 通过隐藏option实现select的联动效果
- 使select option达到超链接的效果实例
- delphi2007 Tstringlist的新增属性 StrictDelimiter
- Magento国家代码缩写
- 简要记录浮点型数据的二进制存储格式
- Python开篇 ------ 重拾三年前的记忆
- css 中的function(index, value)应用-
- IE6 select的option的disabled属性没有效果及解决方案
- Magento运费表设置
- 手机安全领域的领航者
- 移位运算符符
- pthread_cond_wait
- dream a dream
- 【转】如何在Eclipse中运行ibatis的JpetStore
- 基于嵌入式Linux平台的最小文件系统的制作
- Linux C 存储空间动态分配