I created an array of images
function initialize(){
//add our 10 images to our array
imgArray[imageNum++] = new imageItem(imageDir + "img1.jpg");
imgArray[imageNum++] = new imageItem(imageDir + "img2.jpg");
imgArray[imageNum++] = new imageItem(imageDir + "img3.jpg");
}
var totalImgs = imgArray.length;
I then create a function that is linked with a in my html file:
<button id="startButton" onclick="startImage()">Start</button>
function startImage(){
document.getElementById("pic").setAttribute("src", imgArray[0].src);
}
My image tag : <img id="pic" src="" height="300" width="500" border="0" alt="image">
This fails to update my img object, i used firebug to look at the DOM and my array is being populated properly but the img src is not be set?
imageItem? Are you certain it returns anHTMLImageElement? And are you certain yourimageDiris correct?