Hi everybody,
I am trying to write some functions involving setTimeout, but I’m getting hung up on passing parameters to the function referenced by setTimeout. For example, I have a function RotatePictures that takes 3 parameters — a number, a string, and an array. The first two work fine (well, there might be an easier way to get them too, if anyone knows) but the array results in an error (the name is not recognized, has no properties):
[CODE]function rotatePictures(wait, billbd, picts) {
pictNum = pictNum+1; if (pictNum==picts.length) pictNum=0;
document.getElementById(billbd).src = picts[pictNum].name;
setTimeout(‘rotateBoard(‘+wait+’, “‘+billbd+'”, picts)’, wait);
}
At one point I tried to make a custom object with rotatePictures as a method, so that the call to setTimeout was
setTimeout(‘this.rotatePictures();’);
However, I got an error that this.rotatePictures was not recognized.
I am guessing that the reason for these errors is that when the thread calls rotatePictures, it is out of the scope of ‘this’ or picts, but I don’t know what to do about it.
thanks for your help! Karen.