Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with image preload.

    The images that i am preloading do not seem to work.Is there a limit to how many you can load?
    here is the code I am using.
    PHP Code:
    <script type="text/javascript">
       
    // <![CDATA[
         
    function loadImage(){
         var 
    careerOn = new Image();
         
    careerOn.src "images/links/careerOn.gif";

         var 
    careerClick = new Image();
         
    careerClick.src "images/links/careerClick.gif";

         var 
    conferenceOn = new Image();
         
    conferenceOn.src "images/links/conferenceOn.gif";

         var 
    conferenceClick = new Image();
         
    conferenceClick.src "images/links/conferenceClick.gif";

         var 
    contactOn = new Image();
         
    contactOn.src "images/links/contactOn.gif";

         var 
    contactClick = new Image();
         
    contactClick.src "images/links/contactClick.gif";

         var 
    corpOn = new Image();
         
    corpOn.src "images/links/corpOn.gif";

         var 
    corpClick = new Image();
         
    corpClick.src "images/links/corpClick.gif";

         var 
    eventOn = new Image();
         
    eventOn.src "images/links/eventOn.gif";

         var 
    eventClick = new Image();
         
    eventClick.src "images/links/eventClick.gif";
          }
      
    // ]]>
    </script>

    <body onload="loadImage()"> 
    Any help will be great, Thanks

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    I'll join the club...

    Good question... I remember I use a similar code too, and seemed like working from time to time... At that time I have not found an answer... What about now? Anyone any ideea?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question

    I have had the same problem before!.... i find a good way that works is to preload the images by setting a img in a hidden div using a time delayed loop that every 10 ms or so checks to see if the image is .complete and if true sets the image src to a next src url in an array
    Kris Hubby
    kwhubby site


  •  

    Posting Permissions

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