My site includes Javascript code to wipe out all images that did not download (i.e., were not found), so that annoying “missing image” icon does not appear. The code – curtesy of forum members – is simply this:
window.onload = function(){
for(var i=0; i<document.images.length;i++){
if(document.images[i].readyState!=’complete’){
document.images[i].src=’
}
}
where spacer.gif is a blank image. This works fine under IE, but on Firefox, it causes weird things: First, all images loas fine, then they ALL disappear, and the browser waits for the website forever. Once I remove that code, all works well.
It looks like the readyState property is not supported in Firefox. When I try to alert() it, it says undefined. [Incidentally, if I compare the value of an undefined object to a specific string, shouldn’t the result be false and the code in the if statement above not execute?]
So, how do I do this so it works under Firefox as well?