This is a basic question but most examples I find are a little bit too complex.
I am trying to create an array of photos, and then display only a selected one.
This is my array:
var imgArray = new Array();
imgArray[0] = new Image();
imgArray[0].src = 'images/pie1a.png';
imgArray[1] = new Image();
imgArray[1].src = 'images/pie1b.png';
imgArray[2] = new Image();
imgArray[2].src = 'images/pie2a.png';
imgArray[3] = new Image();
imgArray[3].src = 'images/pie2b.png';
This is my HTML:
<img src=imgArray[1] width="33" height="32">
I also tried this:
document.write('<img src="' + imgArray[1] + '" width="120" height="120"/>');
The photo is never displayed. What am I doing wrong?