Forum Moderators: open
I have a JS function that will preload my images for a slideshow, and then i want to show the first image of the slide show when the page is opened. I can get this working fine in IE, but when viewing in Firefox, and just cant get it to work.
The Javascript function that is doing the preload:
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i] = new Image()
myimages[i].src = preloadimages.arguments[i]
}
}
preloadimages("images/image0.jpg")
and where I am calling the image in the HTML.
<td height="310" valign="top" align="center">
<a href="javascript:warp()"><img id="targetimage" alt="click to return to portfolio" src="javascript:document.getElementById('targetimage').src=myimages[0].src"></a>
</td>
I have also tried it this way, and it also didnt work.
<td height="310" valign="top" align="center">
<a href="javascript:warp()"><img id="targetimage" alt="click to return to portfolio" src="javascript:document.images.targetimage.src=myimages[0].src"></a>
</td>
Any help would really be appreciated
You could just hard code the first image path into the src instead, or..
<td height="310" valign="top" align="center">
<a href="#" onclick="warp();return false;"><img id="targetimage" alt="click to return to portfolio"></a>
</td>
<script type="text/javascript">
document.getElementById("targetimage").src=myimages[0].src;
</script>