I have an array of images which pre-load and I have nine img tags on my page. I want to randomly replace and scramble the nine imgs with images from the array when i hover over a button. this all works but, it runs slowly, the imgs re-load the src. how do i
var arrayImg = new Array();
arrayImg[0] = new Image();
<img id="img0" >
then do:
document.getElementbyID("img0").src = arrayImg[random_ndx].src;
there are 9 images.
I am running ie8 on a new fast pc but there is a very noticeable lag in the images changing. So, my question; how do I assign a cached image (arrayImg[random_ndx]) directly to an element () on the page?