Implementation of png Image transparency in IE and VB (vb source code packaging)

Source: Internet
Author: User

1. Use js files to make IE support png images transparent.
Pngfix. js: Copy codeThe Code is as follows: var arVersion = navigator. appVersion. split ("MSIE ")
Var version = parseFloat (arVersion [1])
Function fixPNG (myImage)
{
If (version> = 5.5) & (version <7) & (document. body. filters ))
{
Var imgID = (myImage. id )? "Id = '" + myImage. id + "'":""
Var imgClass = (myImage. className )? "Class = '" + myImage. className + "'":""
Var imgTitle = (myImage. title )?
"Title = '" + myImage. title + "'": "title = '" + myImage. alt + "'"
Var imgStyle = "display: inline-block;" + myImage.style.css Text
Var strNewHTML = "<span" + imgID + imgClass + imgTitle
+ "Style = \" "+" width: "+ myImage. width
+ "Px; height:" + myImage. height
+ "Px;" + imgStyle + ";"
+ "Filter: progid: DXImageTransform. Microsoft. AlphaImageLoader"
+ "(Src = \ '" + myImage. src + "\', sizingMethod = 'Scale'); \"> </span>"
MyImage. outerHTML = strNewHTML
}
}

Usage:
In the template's <HEAD>
<! -- [If lt IE 7]>
<Script defer type = "text/javascript" src = "pngfix. js"> </script>
<! [Endif] -->


Height and width cannot be removed. Method from autoit, detailed description can look at the original http://homepage.ntlworld.com/bobosola/index.htm

2. The vb program uses png images for startup pictures. Here is a class for reading png images in vb, one of my previous programs used this class to implement the PNG transparent effect startup screen.
Resources in the attachment are downloaded from the pillow object.

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.