IE6/7andIE8/9/10 (IE7 mode) hides the parent and child elements with absolute or relative, and then displays the parent element _ javascript technique.

Source: Internet
Author: User
In most cases, hide (set display: none) an element. You do not need to hide all its child elements in sequence. To do this, you may encounter unexpected bugs. As follows:
1, two p, d1 contains d2
Both d1 and d2 have absolute or relative.
3. Hide d1
4. Hide the child element d2.
5. Display d1
At this time, IE6/7 and IE8/9/10 (IE7 mode) will find that the child element d2 can also be displayed (don't forget, d2 is displayed: none ). However, IE8/9/10/Firefox5/Safari4/Chrome12 neutron element d2 is still hidden.
Code Reproduction

The Code is as follows:






IE6/7 and IE8/9/10 (IE7 mode) hides the parent and child elements with absolute or relative in turn, and then displays the parent element. The child element can still display bugs.



1) Hide p [id = d1]
2) Hide p [id = d2]
3) show p [id = d1]





Script
Var d1 = document. getElementById ('d1 ');
Var d2 = document. getElementById ('d2 ');
Function hidden_d1 (){
D1.style. display = "none ";
}
Function hidden_d2 (){
D2.style. display = "none ";
}
Function display_d1 (){
D1.style. display = "block ";
}
Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.