// JavaScript Documentunction correctPNG() // PNG纠正控件 1.0 For IE 5.5或更高. // PNGHandler: Object-Oriented Javascript-based PNG wrapper // -------------------------------------------------------- // Version 1.1.20031218 // Code by Scott Schiller - www.schillmania.com // -------------------------------------------------------- // Description: // Provides gracefully-degrading PNG functionality where // PNG is supported natively or via filters (Damn you, IE!) // Should work with PNGs as images and DIV background images. function PNGHandler() { var self = this; this.na = navigator.appName.toLowerCase(); this.nv = navigator.appVersion.toLowerCase(); this.isIE = this.na.indexOf('internet explorer')+1?1:0; this.isWin = this.nv.indexOf('windows')+1?1:0; this.ver = this.isIE?parseFloat(this.nv.split('msie ')[1]):parseFloat(this.nv); this.isMac = this.nv.indexOf('mac')+1?1:0; this.isOpera = (navigator.userAgent.toLowerCase().indexOf('opera ')+1 || navigator.userAgent.toLowerCase().indexOf('opera/')+1); if (this.isOpera) this.isIE = false; // Opera filter catch (which is sneaky, pretending to be IE by default) this.transform = null; this.getElementsByClassName = function(className,oParent) { doc = (oParent||document); matches = []; nodes = doc.all||doc.getElementsByTagName('*'); for (i=0; i= 5.5) { // IE proprietary filter method (via DXFilter) self.transform = self.filterMethod; } else if (!this.isIE && this.ver < 5) { self.transform = null; // No PNG support or broken support // Leave existing content as-is } else if (!this.isIE && this.ver >= 5 || (this.isIE && this.isMac && this.ver >= 5)) { // version 5+ browser (not IE), or IE:mac 5+ self.transform = self.pngMethod; } else { // Presumably no PNG support. GIF used instead. self.transform = null; return false; } return true; } this.init = function() { if (this.supportTest()) { this.elements = this.getElementsByClassName('png'); for (var i=0; i