YAHOO.calendar.cal1 = new YAHOO.widget. Calendar2up("YAHOO.calendar. cal1","container1",(thisMonth+1)+ "/"+thisYear,(thisMonth+1)+ "/"+thisDay+"/"+thisYear); YAHOO.calendar.cal1.title = "Select your desired check-in date:"; YAHOO.calendar.cal1.setChildFunction ("onSelect",setDate1); YAHOO.calendar.cal1.render();
A lot of variables are set in Script 16.9's
init() routine when the page is loaded, but we're concerned with the ones that handle our new calendars. Here, we create
cal1 (the first of the two 2-up calendars) to be of type
Calendar2up and initialized to display in the
container1 div . When it's first displayed, the current month and current day will be selecteddon't let those
+1 's to the month throw you off; they're there to make the JavaScript month equal to the real-world month. Next we set the title, and then we set the calendar's
onselect event handler to call the
setDate1() function. And finally, we render the calendar.