Menu
I’m clearly doing this wrong. I’m trying to nest a while loop in a function under the assumption that variables are global. Clearly they are not. How can I do this correcty?
[code]
<SCRIPT>
var xpos=0;
var ypos=0;
var rowisoffest=0;
function drawrow(){
while(xpos<576){
document.write(‘<img style=”position:absolute;left:’+ xpos +’px;top:’+ ypos +’px;” src=”floor.gif”>’);
var xpos=xpos+64;
}
}
while(ypos<320){
if(rowisoffset==1){
var xpos=32;
var rowisoffest=0;
}else{
var xpos=0;
var rowisoffset=1;
}
drawrow();
var ypos=ypos+16;
}
</SCRIPT>