[Javascript] An image loader working in FF but not in Opera, Safari...
Hakan
hakan at backbase.com
Wed Jul 13 08:01:16 CDT 2005
Hi Guillaume,
Two things:
> var img = content.getElementsByTagName("img");
>
> if ( img.complete ) {
getElementsByTagName returns an array with the nodes matching the tag
name. This array doesn't have a "complete"-property, and I'm guessing
that the only reason this "works" in Firefox is because it will get here
on window load and, since both conditions hide the loading div, it gets
hidden.
> window.onload = checkDone;
When this triggers, images should already have been loaded.
I'm sorry, but this script seems to do nothing.
Regards,
H
Guillaume wrote:
>
> Hi list,
>
> I've managed to build with Roger Roelofs an image preloading script.
> It's working just fine in Firefox, but Safari and Opera won't catch the
> "loading image..." process, and just display the image when the page is
> loaded.
> Here is the inline script:
>
> <script type="text/javascript">
>
> loader += '<div id="loader" style="display:block;"><p>Loading data...<p/></div>';
>
> document.write(loader);
>
> </script>
>
>
> <script type="text/javascript">
>
> function checkDone() {
>
> var content = document.getElementById("content");
>
> var img = content.getElementsByTagName("img");
>
> if ( img.complete ) {
>
> document.getElementById('loader').style.display = 'none';
>
> } else {
>
>
>
> document.getElementById('loader').style.display = 'none';
>
>
>
> }
>
> }
>
> window.onload = checkDone;
>
> </script>
>
> I have setup a test page to understand what's the script about.
> <http://www.hablablow.com/devX/loadTest2/testXXX5.htm>
> So any help on this is warmly welcome...
>
> Thanks.
>
> Guillaume.
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list