HTML and CSS Reference
In-Depth Information
To revise the calendar() function:
◗
1.
Insert the following statement at the beginning of the calendar() function to cre-
ate the
calDate
variable:
// Date that the monthly calendar is based on
var calDate = new Date(“July 6, 2015”);
◗
2.
Insert the following command to call the writeCalTitle() function, as shown in
Figure 12-9:
// Write the header row of the calendar table
writeCalTitle(calDate);
Figure 12-9
revised calendar() function
calls the writeCalTitle()
function to write the
table header row
◗
3.
Save your changes to the file.
◗
4.
Reopen or refresh
ccc.htm
in your Web browser. The calendar table appears in
the upper-right corner of the page, displaying only the title
July 2015
. See
Figure 12-10.
Figure 12-10
table header row
Trouble?
If the table does not appear in the Web page, your JavaScript code
might contain a mistake. Check your code against the code shown in the figures.
Common sources of error include forgetting to close all quoted text strings, failing
to match the use of upper- and lowercase letters in function names and variable
names, misspelling function names and variable names, and failing to close paren-
theses and brackets when required.
Next, you'll study other properties and methods associated with arrays.