SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2000
    Location
    Madawaska, ME, USA
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How can I pre-load my "onmouseover" images so when a user places his cursor on the image, he/she doesn't have to wait for the image to load?

    You can see what I mean at www.mainecoastmarketing.com

  2. #2
    SitePoint Member
    Join Date
    Feb 2000
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With the following code:

    newImg = new Image();
    newImg.src = "image.gif";

    To display this image, use this code:

    document.otherImg.src = newImg.src;

    -Jason Weinstein
    webmaster@maximumedge.com
    http://www.maximumedge.com/

    [This message has been edited by fluffer (edited February 20, 2000).]

  3. #3
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The above source should read:
    newImg = new Image()
    newImg.src = "image.gif"


    While the code in the previous post might work now, it is not fully qualified and the default property for the Image object might change in a future version of javascript. That would cause all your code to stop working and result in many hours of debugging because you wrote it correctly but the object model changed behind your back. The best thing to do is to fully qualify your code so its easier for you to read and easier for others to read. Plus the chances of it "breaking" in the future are less.

    ------------------
    Wayne Luke
    Internet Media Provider


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
  •