Thank you. I made a whole file which contained only the code lines which are relevant. Then I got no error message. So I realized that the problem must be caused somewhere else in the program. I looked at it closely and just above the line
scd=new Array();
there was this line:
rqp;
I thought that might be the problem. In
java, you can declare field variables without initializing them, so I thought you could do that in javascript. Guess not. I tried changing
rqp;
to
rqp=0;
and now everything works fine.
What I think is that when the computer read the program, it stopped at the rqp line.
I'm just wondering, when does the browser read the global variable assignments? Is it when the page is loaded, or does the browser read the global variables only when the program attempts to reference a variable which does not yet have a value?