The code is meant to generate an calendar using javascript and tables. The months and days are in dutch but it should be understandable. Somehow this end in an endless loop while it should stop when days is bigger or the same as the length of my array.
It's supposed to make 12 tables for each month and then fill these up with the days of that month. It's not finished yet since it'll presume that every day will start at sunday. I think I should also note that I'm not that experienced yet.
var months = new Array();
months[0] = "januari";
months[1] = "februari";
months[2] = "maart";
months[3] = "april";
months[4] = "mei";
months[5] = "juni";
months[6] = "juli";
months[7] = "augustus";
months[8] = "september";
months[9] = "oktober";
months[10] = "november";
months[11] = "december";
var maxDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var weekDays = ["zo", "ma", "di", "wo", "do", "vr", "za"];
var kalender = 0;
var days = 1;
var weekDaysNumber = 0;
while(kalender < months.length){
document.write("<table><tr>");
document.write("<th>" + months[kalender] + "</th></tr>");
document.write("<tr>");
while (weekDaysNumber < 7){
document.write("<td>" + weekDays + "</td>";
weekDaysNumber++;
}
document.write("</tr>");
while(days < maxDays[kalender]){
document.write("<td>" + days + "</td>");
var rows = 0;
if(rows == 7 && days !== maxDays[kalender]){
document.write("</tr>");
document.write("<tr>");
rows = 1;
}
rows++;
days++;
}
if(days == maxDays[kalender]){
document.write("</tr></table>");
kalender++;
weekDaysNumber=0;
}
}