Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I preload images?

Status
Not open for further replies.

poplarman

IS-IT--Management
Dec 15, 2001
12
US

I've copied scripts down from other sites and incorporated them into my pages. The result seems to be - no difference!!

Do preload scripts work - if so, what am I doing wrong?

I have a number of rollover images on my index page and it would be of great advantage to have the underlying images already downloaded. Can anyone show me a simple script to preload:

a.gif, b,gif, c.gif etc... even before the cursor moves over the href?

Hay
 
>>I've copied scripts down from other sites...
What about copyright issues?

>>Do preload scripts work
Yes, they do :)

>>what am I doing wrong?
Hmm.. A week ago I wrote a script, but it isn't working. What am I doing wrong?
Can you give me an answer? You ask the same thing.

This is what needed for preloading images:
<script>
im1 = new Image();
im1.src = &quot;picture_on.gif&quot;;

im2 = new Image();
im2.src = &quot;picture_off.gif&quot;;

im3 = new Image();
im3.src = &quot;photo_on.gif&quot;;

im4 = new Image();
im4.src = &quot;photo_off.gif&quot;;

// here goes all image swapping functions and other
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top