SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2001
    Location
    Panhandle of Florida (White Sand/Brown Skin)
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does this effectively preload the pages images?
    so there would be no watching the page piece together kinda like a puzzle?
    Code:
    if (document.images) {
      Image1 = new Image();
      Image1.src = "images/blue_bground.gif";
      Image2 = new Image();
      Image2.src = "images/ghost.gif";
      Image3 = new Image();
      Image3.src = "images/gray_bground.gif";
      Image4 = new Image();
      Image4.src = "images/lower_bground.gif";
      Image5 = new Image();
      Image5.src = "images/lower_bottomright.gif";
      Image6 = new Image();
      Image6.src = "images/lower_column.gif";
      Image7 = new Image();
      Image7.src = "images/mid_bground.gif";
      Image8 = new Image();
      Image8.src = "images/mid_column.gif";
      Image9 = new Image();
      Image9.src = "images/mid_column_bground.gif";
      Image10 = new Image();
      Image10.src = "images/mid_right_bground.gif";
      Image11 = new Image();
      Image11.src = "images/mid_topright.gif";
      Image12 = new Image();
      Image12.src = "images/top_bground.gif";
      Image13 = new Image();
      Image13.src = "images/top_left.gif";
    }
    also... I placed that code between my head and body tags... does it need to be in the head for it to work?

  2. #2
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, this code needs to be inside your <script></script> tags, which is located inside the <head></head> tags.

    remember, when you preload images, you have to call them by the .src name, i.e. image1, image2, etc... if you call up the image from its actual location on your server, you will be loading it from there and not the preloaded cache.

  3. #3
    SitePoint Addict Drinky's Avatar
    Join Date
    Jan 2001
    Location
    England
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by -SeFu-
    Does this effectively preload the pages images?
    so there would be no watching the page piece together kinda like a puzzle?
    Only if the images are small... images still have to download, it's best for loading images that aren't otherwise on the page already(there is no point preloading images that are in img tags) such as the alternate image in a rollover...
    Drinky


Bookmarks

Posting Permissions

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