Home  >  Article  >  Web Front-end  >  IE6/7 and IE8/9/10 (IE7 mode) hide the parent element and child element with absolute or relative in sequence and then display the parent element_javascript technique

IE6/7 and IE8/9/10 (IE7 mode) hide the parent element and child element with absolute or relative in sequence and then display the parent element_javascript technique

WBOY
WBOYOriginal
2016-05-16 18:04:091035browse

As shown below
1, two divs, d1 contains d2
2, d1 and d2 are set to absolute or relative
3, hide d1
4, hide the child element d2
5, display d1
At this time, in IE6/7 and IE8/9/10 (IE7 mode), you will find that the sub-element d2 can also be displayed (don’t forget, d2 is displayed:none). But the neutron element d2 is still hidden in IE8/9/10/Firefox5/Safari4/Chrome12.
Reproduce code

Copy code The code is as follows:





IE6/7 and IE8/9/10 (IE7 mode) Hide the parent element and child element with absolute or relative in turn and then display the parent element. The child element can still display the bug










<script> <br>var d1 = document.getElementById('d1'); <br> var d2 = document.getElementById('d2'); <br>function hidden_d1() { <br>d1.style.display = "none"; <br>} <br>function hidden_d2() { <br>d2. style.display = "none"; <br>} <br>function display_d1() { <br>d1.style.display = "block"; <br>} <br></script>
< /BODY>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn