xine78
02-20-2003, 04:11 PM
I am doing my first JS assignment, and it is not compiling with an error "expecting ';' line 20 character 30". I have a semicolon after every statement, so I'm thinking the code must be wrong. The assignment is to add a calendar to a site with the current date highlighted (among other things), so that's what all the date variables are about. I'm not getting anything to show up on the site, and when I try to open calendar.js I get the compile error.
This is the site:
http://jolleygood.com/ECT270/Asgn5/bcc.htm
The calendar.js file contains the following code:
function Calendar(caldate)
{
MonthName=new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
DayName=new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
Calendar_Day=newDate(caldate);
var ThisDay=Calendar_Day.getDate();
var ThisMonth=Calendar_Day.getMonth();
var ThisYear=Calendar_Day.getFullYear();
document.write('<table id="calendar"><tr><th id="calendar_head" colspan="7"> "+MonthName[ThisMonth]+", "+ThisYear+" </th></tr>');
for (i=0; i<=6; i++) {
document.write('<tr><th class="calendar_weekdays"> "+DayName[i]+" </th></tr>');
}
}
Please let me know if you can help!
This is the site:
http://jolleygood.com/ECT270/Asgn5/bcc.htm
The calendar.js file contains the following code:
function Calendar(caldate)
{
MonthName=new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
DayName=new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
Calendar_Day=newDate(caldate);
var ThisDay=Calendar_Day.getDate();
var ThisMonth=Calendar_Day.getMonth();
var ThisYear=Calendar_Day.getFullYear();
document.write('<table id="calendar"><tr><th id="calendar_head" colspan="7"> "+MonthName[ThisMonth]+", "+ThisYear+" </th></tr>');
for (i=0; i<=6; i++) {
document.write('<tr><th class="calendar_weekdays"> "+DayName[i]+" </th></tr>');
}
}
Please let me know if you can help!