| toadpeng's profilebenhur的书房PhotosBlogLists | Help |
|
October 09 IE在改变下拉菜单的背景色时的一个BUG 当option的数量比select box的size小的时候(例如,当一个select box中的option只有4个而select box的size为8时),这时候如果改变select box的背景色,在IE中会表现为:select box中被option覆盖的那部分的背景色正常地发生了改变,其他部分保持不变。(如下图所示)
select box的背景色最初为红色:
点击button变为白色: 发生这种情况方并不是因为背景色变更时只改变了option的背景色,实际上整个select box的背景色都已经改变了,只是select box中没有被option覆盖的区域没有被重绘而已。这时只要将任何一个windows窗口移动到select box上然后移开,select box被windows窗口覆盖过的区域就会正常地显示变更后的背景色。(如下图) 将一个对话框移到select box上: 移开后,被覆盖的部分正常显示为白色: 在Firefox中不存在这个问题。 源代码: <html> <head> <title>changing <select> background color</title> <script language="javascript"> function foo() { document.getElementById("ListBoxC4").style.backgroundColor = "white"; } </script> </head> <body> <select size="8" id="ListBoxC4" style="background-color:red;"> <option value="1">AAAAA</option> <option value="2">BBBBB</option> <option value="3">CCCCC</option> <option value="4">DDDDD</option> </select> <input type="button" name="ButtonChangeColor" value="ButtonChangeColor" onclick="foo();"/> </body> </html> 测试环境:IE6.0,Firefox1.0.4 相关链接:http://www.htmlcodetutorial.com/help/archive.php/o_t__t_799__changing-and-ltselect-and-gt-background-color.html Comments (2)
TrackbacksThe trackback URL for this entry is: http://toadpeng.spaces.live.com/blog/cns!6489D81CFC135717!340.trak Weblogs that reference this entry
|
|
|