I had reimplemented what you wrote, albeit with feature detection, a defensive style, and omitting the readyState property check. It wasn't until a few hours ago (whilst I was eating dinner) that I realised that you were doing things backwards: hiding the image whilst the document was loading, and showing it once it had completed.
In a script element in the document head:
Code:
onload = function() {
var image = document.images.loading;
if (image.style) image.style.display = 'none';
};
In a script element in the document body:
Code:
document.write('<img id="loading" name="loading" alt="Loading..." src="generater.gif">');
There's no point in displaying the image unless scripting is enabled. Position it using CSS using the id attribute value.
Mike
Bookmarks