// hypercube.js // Include this js file only if you've defined an image with id="Hyper". gifs = new Array( "rotating%20hypercube%20a.gif", "rotating%20hypercube%20b.gif", "rotating%20hypercube%20c.gif", "rotating%20hypercube%20d.gif", "rotating%20hypercube%20e.gif", "rotating%20hypercube%20f.gif" ) gifcount = gifs.length; randomNum = 0; function SelectGif() { randomNum = Math.floor((Math.random() * gifcount)); h=document.getElementById("Hyper"); h.src = "images/Hyper/" + gifs[randomNum]; h.alt = gifs[randomNum]; } function NextGif() { ++randomNum; randomNum %= gifcount; h=document.getElementById("Hyper"); h.src = "images/Hyper/" + gifs[randomNum]; h.alt = gifs[randomNum]; //document.Hyper.src = "images/" + gifs[randomNum] //document.Hyper.alt = gifs[randomNum] }