...

View Full Version : Need help with image preload.



DougieC
10-06-2003, 03:31 AM
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.


<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

Kor
10-06-2003, 09:57 AM
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?

kwhubby
10-07-2003, 06:53 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum