Forum Home
Press F1
 
Thread ID: 62246 2005-10-01 11:36:00 A little more help with java Please! - Preloading images mattyjb (7993) Press F1
Post ID Timestamp Content User
392515 2005-10-01 11:36:00 Hello all. I have recently just put together a home page in which i have several rollover images for the menu. The script doesnt have any type of preload function:
<a href="index.html" onMouseOver="changer('img1',02)" onMouseOut="changer('img1',01)"><img name="img1" id="img1" border="0" width="178" height="38" src="assets/images/home-up.gif" alt="Home"></a>

running in conjunction with:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
//JavaScript Simple Image Rollover Code
//copyright daxassist, 2000-2004
//visit http://www.daxassist.com for this and other javascripts with full tutorials.

if(document.images) {
pics = new Array();
pics[01] = new Image();
pics[01].src = "assets/images/home-up.gif";
pics[02] = new Image();
pics[02].src = "assets/images/home-over.gif";
etc etc etc in the head tags

The problem is when i view it in ie6 everytime the cursor goes over the image there a huge delay for the rollover to appear due to the browser busily downloading the rollover image.

how can i get the browser to preload all the roll-over image without having to go and re-code all the buttons?

any help would be great thanks
M@TT
mattyjb (7993)
392516 2005-10-01 20:08:00 heres a good site for want you want heaps of them google (www.google.co.nz le=%22Embarrassment%22%20smilieid=%222%22%20class= %22inlineimg%22%20/%3Efficial_s&q=preload+images+javascript&spell=1)

or this


<script>
<!-- Hide from old browsers
myPict = new Array("../Images/x1.jpg","../Images/x2.jpg","../Images/x3.jpg","../Images/x4.jpg")
end hide -->
</script>


this is not the complete script but it will preload your images Its a snippet from a web site I administer but research those google ones as well
beama (111)
1