globalstrata
MIS
I am trying to use the following code in order to generate a random image. However, it gives me errors when I try to load the page using <body onload="newImage()"> and if I use <body background=onload="newImage()"> no errors show up but the images doesn't either. Can anyone advise me what am I doing wrong?
Code:
// Returns a Random Image
n = 0;
MyImages = new Array();
MyImages[0] = '/images/bg.jpg';
MyImages[1] = '/images/bg1.jpg';
MyImages[2] = '/images/bg2.jpg';
function newImage() {
currentIndx = Math.round(Math.random() * 3)
document.theImage.src = MyImages[n]
}
Gladys Rodriguez
GlobalStrata Solutions
Computer Repair, Website Design and Computer Consultant
Small Business Resources