1<public:component> 2<public:attach event="onpropertychange" onevent="doFix()" /> 3 4<script type="text/javascript"> 5 6// IE5.5+ PNG Alpha Fix v1.0RC4 7// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com 8 9// This is licensed under the CC-GNU LGPL, version 2.1 or later. 10// For details, see: http://creativecommons.org/licenses/LGPL/2.1/ 11 12// This must be a path to a blank image. That's all the configuration you need. 13if (typeof blankImg == 'undefined') 14{ 15 var blankImg = document.URL; 16 blankImg = blankImg.substring(0,blankImg.lastIndexOf("/")+1) + "images/blank.gif"; 17 //blankImg = blankImg + "/../images/blank.gif"; 18} 19 20var f = 'DXImageTransform.Microsoft.AlphaImageLoader'; 21 22function filt(s, m) 23{ 24 if (filters[f]) 25 { 26 filters[f].enabled = s ? true : false; 27 if (s) with (filters[f]) { src = s; sizingMethod = m } 28 } 29 else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")'; 30} 31 32function doFix() 33{ 34 // Assume IE7 is OK. 35 if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) || 36 (event && !/(background|src)/.test(event.propertyName))) return; 37 38 var bgImg = currentStyle.backgroundImage || style.backgroundImage; 39 40 if (tagName == 'IMG') 41 { 42 if ((/\.png$/i).test(src)) 43 { 44 if (currentStyle.width == 'auto' && currentStyle.height == 'auto') 45 style.width = offsetWidth + 'px'; 46 filt(src, 'scale'); 47 src = blankImg; 48 } 49 else if (src.indexOf(blankImg) < 0) filt(); 50 } 51 else if (bgImg && bgImg != 'none') 52 { 53 if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) 54 { 55 var s = RegExp.$1; 56 if (currentStyle.width == 'auto' && currentStyle.height == 'auto') 57 style.width = offsetWidth + 'px'; 58 style.backgroundImage = 'none'; 59 filt(s, 'crop'); 60 // IE link fix. 61 for (var n = 0; n < childNodes.length; n++) 62 if (childNodes[n].style) childNodes[n].style.position = 'relative'; 63 } 64 else filt(); 65 } 66} 67 68doFix(); 69 70</script> 71</public:component>