我遇到了一个奇怪的情况,我已经多次遇到过类似的事情。我认为这可能与大量的表格和 div 混合在一起有关。有时,我使用JavaScript将某个div、td等设置为不显示,并且其中一些内容仍然显示在屏幕上。
我确信我使用了正确的 JavaScript 语法。我什至单步执行代码并确保显示值不值。这个这个案例我也是用开发者工具看dom的。在这种情况下,该元素及其所有子元素都设置为 display:none。
我已经见过几次这样的事情了。有人猜到发生了什么事吗?
我在 ie7 兼容模式下使用 ie8。
格雷
I have a stange situation I have come across simular things several times. I think it might have something to do with having tons of tables and divs mixed together. Sometimes, I use JavaScript to set a certain div, td, etc to display none, and some of it's content still shows on the screen.
I am sure I am using the correct JavaScript syntax. I even step through the code and make sure the diaplay value it none. This this case I also used developer tools to look at the dom. In this case the element and all it's children are set to display:none.
I have seen this type of thing a few times. Does anyont have any guess what is going on?
I am using ie8 in ie7 compat mode.
Grae
发布评论
评论(1)
查找!重要声明:
或者非常特定选择器:
如果在外部 CSS 或内联样式中使用其中之一,它将覆盖
display: none;
。更改 CSS 或在 JavaScript 中使用display: none !important;
来解决此问题。Look for the !important declaration:
Or a very specific selector:
If either is used in the external CSS or inline style, it will override
display: none;
. Change the CSS or usedisplay: none !important;
in the JavaScript to workaround this.