pre loading images

Results 1 to 2 of 2

Thread: pre loading images

  1. #1
    Join Date
    Dec 1969

    Default pre loading images

    One of my pages uses image swaps programmed in javascript. However, the images take time to load, which spoils the effect. Is there a way of preloading the images to counter this. If so what is the code and where do I put it ?

  2. #2
    Steve Cimino Guest

    Default RE: pre loading images

    var pictures = new Array("pic1", "pic2", pic3")<BR>var images = new Array(pictures.length)<BR><BR>for(p = 0; p &#060;= pictures.length; p++)<BR> {<BR> images[p] = new Image();<BR> images[p].src = "images/" + pictures[p] + ".gif"<BR> }<BR><BR>Obviously change to what you need. You can also add the full path in the array, but you get the jist.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts