[thelist] Image onload event in behaviors
David Mark (STIG 213)
mark.david at cspb.com
Wed Aug 4 09:49:21 CDT 2004
Hi,
I have been having problems getting the onload event to work properly for image tags. I have written a behavior that should sort out Microsoft's incompatability with transparent PNGs. The function works, but I cannot get the event to fire.
Code:
<PUBLIC:COMPONENT NAME="fixPNGs">
<PUBLIC:ATTACH event="onload" handler="fixIt" />
<script>
function fixIt() {
alert()
if (element.src.match(/\.png$/i) != null) {
element.style.width = element.width + "px";
element.style.height = element.height + "px";
element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + element.src + "', sizingMethod='scale')"
element.src = "http://localhost/images/spacer.gif";
}
}
</script>
</PUBLIC:COMPONENT>
Any help is much appreciated.
Beaker.
More information about the thelist
mailing list