Two methods to enable IE6 to display pictures in PNG-24 format normally

Source: Internet
Author: User

Comments: The default IE6 does not display PNG-24 format pictures, we can through the following two good methods to achieve a simple display IE6, interested friends can refer to the nextMethod 1:
Add the following code after
Copy codeThe Code is as follows:
<! -- [If IE 6]>
<Script type = "text/javascript">
Function correctPNG ()
{
For (var I = 0; I <document. images. length; I ++)
{
Var img = document. images [I]
Var imgName = img. src. toUpperCase ()
If (imgName. substring (imgName. length-3, imgName. length) = "PNG ")
{
Var imgID = (img. id )? "Id = '" + img. id + "'":""
Var imgClass = (img. className )? "Class = '" + img. className + "'":""
Var imgTitle = (img. title )? "Title = '" + img. title + "'": "title = '" + img. alt + "'"
Var imgStyle = "display: inline-block;" + img.style.css Text
If (img. align = "left") imgStyle = "float: left;" + imgStyle
If (img. align = "right") imgStyle = "float: right;" + imgStyle
If (img. parentElement. href) imgStyle = "cursor: hand;" + imgStyle
Var strNewHTML = "<span" + imgID + imgClass + imgTitle + "style = \" "+" width: "+ img. width + "px; height:" + img. height + "px;" + imgStyle + ";" + "filter: progid: DXImageTransform. microsoft. alphaImageLoader "+" (src = '"+ img. src + "', sizingMethod = 'Scale'); \"> </span>"
Img. outerHTML = strNewHTML
I = I-1
}
}
}
CorrectPNG ();
</Script>
<! [Endif] -->

Method 2:

Copy codeThe Code is as follows:
<! -- [If IE 6]>
<Script src = "js/DD_belatedPNG_0.0.8a.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
DD_belatedPNG.fix ('*');
</Script>
<! [Endif] -->

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.