function init() { YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("YAHOO.example.calendar.cal1","cal1Container"); YAHOO.example.calendar.cal1.render(); }
<p>The default Calendar implementation is a single-select 1-up calendar view that defaults to the current month and year. The basic calendar can be implemented by declaring a variable to represent the calendar, and passing the calendar's ID to the Calendar constructor:</p> <textarea name="code" class="JScript" cols="60" rows="1"> var cal1; function init() { cal1 = new YAHOO.widget.Calendar("cal1", "cal1Container"); cal1.render(); } </textarea> <p>The Calendar object should be instantiated after the body has been rendered, so that a reference to the container element that will contain the calendar can be obtained. The container element can reside anywhere within the body.</p> <textarea name="code" class="HTML" cols="60" rows="1"> <div id="cal1Container"></div> </textarea>