HTML and CSS Reference
In-Depth Information
To create the writeDayNames() function:
1. Return to the calendar.js file in your text editor.
2. At the bottom of the file, insert the following function as shown in Figure 12-15:
function writeDayNames() {
// Array of weekday abbreviations
var dayName = [“Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”];
// Start a table row of the weekday abbreviations
// Loop through the dayName array
for (var i = 0; i < dayName.length; i++) {
document.write(“<th class='calendar_weekdays'> “ +
dayName[i] + “</th>”);
// End the table row
Figure 12-15
creating the writeDaynames() function
3. Scroll up to the calendar() function and then insert the following code as shown in
Figure 12-16 to call the writeDayNames() function:
// Write the row of weekday abbreviations
Search WWH ::

Custom Search