Forum Moderators: open
var imgS = new Array();
imgS[0] = "img/tsassemble.jpg";
imgS[1] = "img/ia_images.jpg";
imgS[2] = "img/mil_images.jpg";
imgS[3] = "img/med_images.jpg";
imgS[4] = "img/svr_images.jpg";
var downloadCountdown = 200;
function PreloadImages() {
var preloadedImage = new Image()
for (var j = 0; j < imgS.length; j++) {
preloadedImage.onload = downloadCount;
preloadedImage.src = imgS[j];
}
}
function downloadCount() {
//if(--downloadCountdown==0)
alert(imgS.length)
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//END
Go easy on me, I am new, and using Dreamweaver as a crutch.. :)
Now I placed the downloadCount function in an attempt to "see" if the images are being loaded. Basically my thinking is that if it is trying to preload the images, I should get a message box for each of them. What happens is the page loads, I get an alert with the correct array length (5). I see 2 alerts and then nothing. I expected to see 5 alerts, one for each image.
After the page loads, if I rollover the links that trigger the mm_swapimage function then it appears to have to load the image in question. Once I do this once then they seem to be loaded.
Any ideas or suggestions on how to proceed would be greatly appreciated!
<head>...
if (this.Image) var imgS = [
new Image("img/tsassemble.jpg"),
new Image("img/ia_images.jpg"),
new Image("img/mil_images.jpg"),
new Image("img/med_images.jpg"),
new Image("img/svr_images.jpg")
];
<script language="javascript" type="text/javascript">
if (this.Image) var imgS = [
new Image("img/tsassemble.jpg"),
new Image("img/ia_images.jpg"),
new Image("img/mil_images.jpg"),
new Image("img/med_images.jpg"),
new Image("img/svr_images.jpg")
];
</script>