GrandpaB
08-19-2005, 02:32 AM
I have coded a function Blink(row,col) that uses the setTimeout function to alternately display two images.
function Blink(row,col){
var blinkId="ex"+row.toString()+col.toString();
var imgName=document.getElementById(blinkId).src;
var indx=imgName.indexOf("blank");
var imgNum=(indx==-1)? 0:3;
document.getElementById(blinkId).src=Img[imgNum];
//window.setTimeout("Blink(row,col)",700);
Xrow=row;
Xcol=col;
window.setTimeout("Blink(Xrow,Xcol)",700);
}
The routine works, but it only works because one of the original statements has been commented out and I added the last three statements. If I use the original code I get an error telling me that 'row' is not defined. What am I missing in my understanding of JavaScript?
Thanks for your wisdom.
function Blink(row,col){
var blinkId="ex"+row.toString()+col.toString();
var imgName=document.getElementById(blinkId).src;
var indx=imgName.indexOf("blank");
var imgNum=(indx==-1)? 0:3;
document.getElementById(blinkId).src=Img[imgNum];
//window.setTimeout("Blink(row,col)",700);
Xrow=row;
Xcol=col;
window.setTimeout("Blink(Xrow,Xcol)",700);
}
The routine works, but it only works because one of the original statements has been commented out and I added the last three statements. If I use the original code I get an error telling me that 'row' is not defined. What am I missing in my understanding of JavaScript?
Thanks for your wisdom.