English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi there,

I don't know much about javascitp and have been sitting here the whole day trying to find a script for a pretty simple thing without success.

I need a script who can do the following:

1. A number of images will be preloaded

2. An animated gif image will be visible and some sort of bar (or text) will show the progress

3. When all images are preloaded the user will be redirected to another page

If some expert on javascript out there cold help me I would be incredibly grateful.

The script will replace the current (fake) loader on this page, which simply redirects after 20 seconds: www.worldsphotos.com

Thanks in advance!
Fredrik

2007-05-21 03:05:04 · 2 answers · asked by Freddo 1 in Computers & Internet Programming & Design

2 answers

Here is the code to preload an image.

var pic = new Array(1); // make this array size to match the number of images
pic[0] = new Image();
pic[0].src = 'images/imagename.jpg'; // preloads images

for the second part this may be a bit more tricky.
Try and create a general loading animated image to indicate progress rather than a progress bar.

I hope this helps.

2007-05-21 03:54:08 · answer #1 · answered by AnalProgrammer 7 · 0 0

That code tells me that the image is in the same place as the html. The norm is to put the images in the images folder. So where do you store our images?

2016-05-18 22:20:01 · answer #2 · answered by ? 3 · 0 0

fedest.com, questions and answers