Hi. I need some help with arrays in JavaScript. I am creating a slideshow and have to store the images in an array on a separate file. I need some feedback as far as am I missing something in this file and how can I then call this array into my slideshow file? So far, I have:

<script type="text/javascript">

	// Create an array to hold image filenames
	var images = new Array();
	// Populate array with image filenames
	imgname[0] = 'home.jpg';
	imgname[1] = 'beach.jpg';
	imgname[2] = 'pool.jpg';
	imgname[3] = 'garden.jpg';
	imgname[4] = 'pond.jpg';
	imgname[5] = 'car.jpg';

10 Years
Discussion Span
Last Post by HenryGR

You create a new array

var images = new Array();

and then you want to reference

imgname[0] = 'home.jpg';

..hmmm! names do not match.

Also, creating a new array, does not create a new array if images... you may want to create the elements of the array as:

images[0] = new image();
image[0].src = 'home.jpg';

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.