Topic: HTML Questions
I am having problems with the following JavaScript code included in my page http://qwerty-2009.angelfire.com/js-prime.html .
<SCRIPT>
a=new Array;ttt=new Array;
a[0]="Algorithm ... ";ttt[0]=0;
......
a[3]="or ... ";ttt[3]=2;
for(j=0;j<=3;j++){
c=a[j];
document.write(tab(ttt[j]));document.write(c);
document.write("<br>");}
</SCRIPT>
Here tab(n) is a string valued function defined in the head which gives a number of blank spaces.
I find that the first element of the array a is output correctly, but on subsequent passes of the "for" loop the value output is "undefined". No matter what i change the lower limit of the "for" loop to within the range 0..3, the first value is correctly written while the rest are given as "undefined".