Posted by Stevo on 10/25/07 22:02
SaraLeePerson@gmail.com wrote:
> <script>
> pic100= new Image;
> pic100.src="./imageme.gif";
> </script>
>
> <img src=./imageme.gif>
OK, you're expectations are too high. That pic100.src *is* starting to
preload the file, but your img tag is going to start using it long
before it will be finished loading. What people usually do in cases like
this is to set the img src to a blank image, and only when pic100.src
has finished loading, do you then change the src of the img to point to
it. If you google "preload images javascript" you'll find lots of
ready-coded examples.
[Back to original message]
|