Forum Moderators: not2easy
The code is nothing fancy.
<SCRIPT LANGUAGE="JavaScript">
<!--
function swapImage(target,location) {
if (document.images) {
document[target].src = location
}
}
//-->
</script>
<a href="javascript:;" onClick="swapImage('bigPic','images/pic1.jpg')"><img src="images/thumbs/pic1thumb.jpg" width="61" height="85" border="0"></a> Thanks
What I did was to pre-load all the images during the page load that I need to use and not wait for the user to activate the graphic download. The page load time is slowed a bit but my graphics aren't real big so it really doesnt show.
Here's the code I use for the preload:
function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
<body onLoad="MM_preloadImages('Images/image1.jpg','Images/image2.jpg','Images/image3.jpg','Images/image4.jpg','Images/image5.jpg')">
This may or may not help you but it worked for me :)
Cheers