IE6 hack for js collection, ie6hack

Source: Internet
Author: User

IE6 hack for js collection, ie6hack

1. iframe not displayed in ie6

In ie6, iframe is not displayed. It can only be displayed after refreshing. This problem is not caused by slow page loading. There are several possible causes of this problem:

The src attribute is placed first in iframe (not met)
The height is set to 100%. iframe in ie6 cannot get the actual height value. Solution: Set it to a fixed height value.
This problem also occurs when the onclick event is triggered by TAG a to dynamically create an iframe. Solution: Add return false to the click function. For example:


2. Multiple loading of css sprite in ie6

In css sprite under ie6 and css using the background image, the same image is loaded multiple times, increasing the number of requests, and flashing occurs in images with hover effect. Solution:

  <!--[if IE 6]>     <script type="text/javascript">    document.execCommand("BackgroundImageCache",false,true);  </script>  <![endif]-->

3. page Jump failure

When js window. location. href = url is used in ie6 to perform page Jump, this will be invalid, especially when onclick is used in the tag to execute this function. Solution:

  window.location.href=url;return false;


How to Use CSS hack in IE6, IE7, and Firefox

Previously I used this:

XML/HTML code
Background: orange;
* Background: green! Important;
* Background: blue;
Now record another method:

XML/HTML code
Height: 20px;/* For Firefox */
* Height: 25px;/* For IE7 & IE6 */
_ Height: 20px;/* For IE6 */
Note:

Tests in ie6 and firefox can be displayed normally, and hack technology is successfully applied.
But the newly released ie7 pair! Important can be correctly explained. The page cannot be displayed as required!

Now we can find a good hack Method for IE7: Use "* + html "!
Now you can use IE7 to browse it. It should be okay.

Example:

XML/HTML code
Example Source Code
# Example {color: #333;}/* Moz */
* Html # example {color: #666;}/* IE6 */
* + Html # example {color: #999;}/* IE7 */

In firefox, the font color is displayed as #333,
In IE6, the font color is displayed as #666,
In IE7, the font color is #999, and they do not interfere with each other!

This can also be done, and it is applicable to In-line writing (<div style = ".........."> ):

XML/HTML code
Width: 100px;/* Mozilla */
+ Width: 110px;/* IE7 */
_ Width: 120px;/* IE6 */

The order cannot be broken, because the more compatible the above, that is, IE6 recognizes "+ ".

How can I use hack technology for IE6 in CSS?

The method mentioned above does not pass w3c mark authentication. If you want to set properties for ie6 separately, you only need to write them like this.
* Html. class {}
Replace. clss with the name you want. It can also be an id.

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.