Welcome to the sixth part of an eight-part article series that shows you how to build a web page calendar. Up to now we've mostly been dealing with calculating and displaying the months. In this part of the series I talk about the layout of the calendar, and I introduce a new function that will show an entire year at a time.
Showing a Full Year with a Web Page Calendar - The Show Current Year's Calendar Button (Page 2 of 4 )
When the Show Current Year's Calendar Button is clicked, the calendar for the current year appears. When you click outside the calendar of the year, on the body element, the calendar disappears. The tag for this button is:
<button type="button" onclick="CalJustClicked = true; showYear('current')">Show Current Year's Calendar</button>
The value (string) for the onclick attribute begins with
CalJustClicked = true;
This statement serves the same purpose as we saw before. The next statement in the value (string) is:
showYear('current')
This calls a new function, showYear(year), which I will now describe.