프로그램/html,css2009. 9. 7. 14:26

[파일 : iepngfix.htc]

<public:component>
<public:attach event="onpropertychange" onevent="doFix()" />

<script type="text/javascript">
if (typeof blankImg == 'undefined') var blankImg = '/Common/blank.gif';
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';

function filt(s, m) {
    if(filters[f]) {
        filters[f].enabled = s ? true : false;
        if (s) with (filters[f]) { src = s; sizingMethod = m; }
    }
    else if(s) {
        style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'");';
    }
}

function doFix() {
    if(!/MSIE (5\.5|6\.)/.test(navigator.userAgent) || (event && !/(background|src)/.test(event.propertyName))) return;
    var bgImg = currentStyle.backgroundImage || style.backgroundImage;
    if(tagName == 'IMG') {
        if((/\.png$/i).test(src)) {
            if(currentStyle.width == 'auto' && currentStyle.height == 'auto')
                style.width = offsetWidth + 'px';
                filt(src, 'image');
                src = blankImg;
        }
        else if(src.indexOf(blankImg) < 0) filt();
    }
    else if(bgImg && bgImg != 'none') {
        if(bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) {
            var s = RegExp.$1;
            if(currentStyle.width == 'auto' && currentStyle.height == 'auto')
                style.width = offsetWidth + 'px';
                style.backgroundImage = 'none';
                filt(s, 'crop');
            for(var n = 0; n < childNodes.length; n++)
                if(childNodes[n].style) childNodes[n].style.position = 'relative';
        }
        else filt();
    }
}
doFix();

</script>
</public:component>

 

설명> 이 소스를 iepngfix.htc 파일로 만든다.

 

 

[파일:css에서 호출]

<style type="text/css">
.png24 { behavior: url('./iepngfix.htc'); }
</style>

 

설명> 이 소스를 처럼 iepngfix.htc 파일을 css로 호출해서 사용한다.

Posted by 은둔고수