为什么IE(IE8,特别是)没有在禁用的多选框中突出显示所选选项? [英] Why does IE (IE8, specifically) not highlight selected option in a multi select box which is disabled?
问题描述
我在JSP页面中有一个多选框,它有一些选项并被禁用。
I am having a multi select box in a JSP page which has some options and is disabled.
<select id="mySelectBox" multiple disabled>
<option value="first" selected>First</option>
<option value="second">Second</option>
<option value="third">Third</option>
<option value="fourth" selected>Fourth</option>
</select>
我选择了第一个和第四个选项,但它们没有在IE中突出显示它们被正确突出显示当我使用Firefox时。
I have the first and the fourth options selected, but they are not highlighted in IE They are properly highlighted when I use Firefox.
这有什么解决方案或解决方法吗?
Is there any solution or workaround for this?
编辑:我的DOCTYPE是<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.01 Transitional // ENhttp://www.w3.org/TR/html4/loose。 dtd>
但即便如此,我也没有看到任何差异。
My DOCTYPE is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
But even with that I don't see any difference.
推荐答案
有趣的是,这个 CSS解决方法似乎解决了我的问题!!
Interestingly, this CSS workaround seems to have fixed my issue!!
select[disabled="disabled"][multiple="multiple"]{
background-color:#D4D0C8;
}
select[disabled="disabled"][multiple="multiple"] option[selected="selected"]{
background-color:navy;
}
有趣的是因为早些时候我使用过相同的效果。也许我错过了一些东西。
Interesting because, earlier I had used the same to no effect. Perhaps I had missed out on something then.
这篇关于为什么IE(IE8,特别是)没有在禁用的多选框中突出显示所选选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!