pre-loading images (script?)

V

VR

Hi,

I am trying to have a menu item (which is an HTML img) to
change as a mouse moves over it. So, my code looks
something like this:

<a
onmouseover="ActivateImage('MyImage');"
onmouseout="InactivateImage('MyImage');"
href="javascript:void(FollowLink('MyImage'));">
<IMG height="22" src="Image1.gif" name="MyImage">
</a>

<script>
function ActivateImage(ImageName)
{
document.images(ImageName).src = "Image2.gif"
}

function InactivateImage(ImageName)
{
document.images(ImageName).src = "Image1.gif"
}
</script>


I have about 20 images setup in the similar way on my
page.

The problem is that when the page is loading, it seems
that only the images that are specified in my HTML are
loaded. The other images start loading as I move mouse
over original images. So, since it takes a whlie for those
alternate images to load, the very first time I move mouse
over an image and then quickly move it away the switch
doesn't happen.

Is there any way to make sure that my alternate images get
loaded with my page right away? Or should I use a
different approach all together?

Thanks a lot for any help.

VR
 
J

Joe Gass

You need to use javascript for this, I personally use Macromedia Dreamweaver
to set this kind of thing up
Try a search on google for "preloading images"
 
M

Munsifali Rashid

You need to use JavaScript to preload the images. However, preloading
images is sometimes ignored if a user has changed their browser's settings.
The safest way to do this, is to load all the images into two or more
layers, and then show/hide the layers accordingly.

Mun
 
V

Vic

Thanks.

VR

Joe Gass said:
You need to use javascript for this, I personally use Macromedia Dreamweaver
to set this kind of thing up
Try a search on google for "preloading images"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top