Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop images, load images, then goto another page

Status
Not open for further replies.

Jeepers321

Technical User
Oct 17, 2000
17
US
Here is some idea of what I am trying to do.

1 - Preload my images to the page.
2 - When user clicks the imgclick.gif
2 - the javascript will loop through these images one at a time at
approximatly 50 millisconds using id="imgmain" as its holder.
3 - when the javascript gets to the the last image in the loop I need
to have another webpage load with the target being _self.


Here is the javascript that I have so far.


<html>


<head>
<title></title>


<script language="javascript"><!--
//Preload Images
var image01 = new Image();
image01.src = "images/img1.gif";
var image02 = new Image();
image02.src = "images/img2.gif";
var image03 = new Image();
image03.src = "images/img3.gif";


function doPreload()
{
var the_images = new Array('images/img1.gif',
'images/img2.gif',
'images/img3.gif');
preloadImages(the_images);
}
function preloadImages(the_images_array) {
for(var loop = 0; loop < the_images_array.length;
loop++)
{
var an_image = new Image();
an_image.src = the_images_array[loop];
}
}


// Not sure how to build a function here that will loop through the
images(or the Array) and and load the images into the "imgmain".


//--></script>


<meta content="Microsoft Visual Studio .NET 7.1"
name="GENERATOR">
<meta content="name="vs_targetSchema">
</head>


<body onload="doPreload();">
<IMG id="imgmain" src="images/img1.gif" border="0">
<IMG id="imgclick" src="images/imgclick.gif">
</body>


</html>


Any help would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top