today = new Date();
thismonth = today.getMonth() + 1;
thisyear = today.getYear();
thisday = today.getDate();
maxdays=31;//default
if (thismonth==4 || thismonth==6 || thismonth==9 || thismonth==11)
{
maxdays=30
}
if (thismonth==2)
{
// feb
if ((thisyear/4)!=parseInt(thisyear/4))
{
maxdays=28
}
else
{
//leap year
maxdays=29
}
}
thismonth = "" + thismonth
if (thismonth.length == 1)
{
thismonth = "0" + thismonth;
}
for (var theday = 0; theday <= maxdays; theday++)
{
if (theday == 0)
{
document.write (" "+ thisday + "-" + thismonth + "-" + thisyear )
document.write (" ========")
}
else
{
var thed = "" + theday
if (thed.length == 1)
{
thed = "0" + thed;
}
document.write (" " + thed + "-" + thismonth + "-" + thisyear)
}
}