geke hand
E Z B O A R D
Hide Broken Images (IE Only)

<< updated: 7/23/2003

Summary: Hide the dreaded "Red X" box caused by broken images in posts.

Details:

This script uses the Internet Explorer-only filesize property of images to determine whether they have been properly loaded.

HEAD: (box #1)

<script type="text/javascript">
/* HIDE BROKEN IMAGES */
function hideBroken() {
var showAlt = true;
ai = document.getElementsByTagName("img");
for (im=0; im < ai.length; im++) {
try {
if (ai[im].fileSize <= 0 && ai[im].src.match(".jpg$|.gif$|.png$|.bmp$")) {
if ( ai[im].alt != "" && showAlt ) {
ax = document.createTextNode("(" + ai[im].alt + ")");
ai[im].parentNode.insertBefore(ax, ai[im]);
}
ai[im].style.display = "none";
}
} catch (e) {}
}
}
/* END HIDE BROKEN IMAGES */
</script>

HEAD Notes:

Change the variable "showAlt" to false to not replace the image with it's alt text (where available).

FOOTER: (box #4)

<script type="text/javascript">
/* HIDE BROKEN IMAGES */
setTimeout(hideBroken, 1000);
/* END HIDE BROKEN IMAGES */
</script>

FOOTER Notes:

Change 1000 to the number of seconds you want it to wait before looking for non-loading images, times 1000. So for 3 seconds, you'd change it to 3000.

History:

7/23/2003 - added timer
6/12/2003 - written by phalen180

Credits:

written by phalen180

E Z B O A R D

design by G E K E . N E T
best viewed in 1024x768 screen resolution using a standards compliant browser
logo based on a public domain drawing of a hand making the sign of the cross, no disrespect is intended
all other contents and code copyright © 2002-2005 jonathan cook

Valid HTML 4.01! Valid CSS!