Click to See Complete Forum and Search --> : preload images


dimpie
05-29-2003, 03:11 AM
Hi folks,

I need some help with my (first) website. On one of my contentpages I'm trying to preload some images. The images are loaded in an array. With the function move() I try to access the images.

function move(nr)
{
document.the_image.src='afbnew[nr].src';
}

The function is called in the onmouseover event.

<a class="none" href="#" onMouseOver="move(0)">pony's</a>.

However the images don't show up if you move over the links on the left side of the page.

For testing purposes I stripped the page and put it in a seperate directory together with the images I'm trying to load.

I've already checked if the arrays where being filled correctly, as you can see on my webpage, but that seems to be working fine. So I think the problem lies in the function I defined.

Please have a look at my (test)page to see what I'm doing wrong.
http://home.hetnet.nl/~j.e.dijkstra/Testpreload/test_act.html

Thanks in advance,
Dimpie

AdamGundry
05-29-2003, 03:46 AM
You shouldn't use quotes around the array name, use this instead:
document.the_image.src=afbnew[nr].src;

Currently the quotes mean JS is interpreting the array name as a string literal, rather than a variable.

Adam

dimpie
05-29-2003, 05:27 AM
Thanks a lot Adam,

I removed the quotes and now it works fine.

Dimpie.