DHTMLX Docs & Samples Explorer

Setting sensitive dates

You can set only those dates that the user can select



Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxcalendar.css">
<script>
window.dhx_globalImgPath = "../../codebase/imgs/";
</script> <script src="../../codebase/dhtmlxcommon.js"></script> <script src="../../codebase/dhtmlxcalendar.js"></script> <script>
var mCal,
mDCal,
newStyleSheet;
window.onload = function() {
    mCal = new dhtmlxCalendarObject('dhtmlxCalendar', false, {
        isYearEditable: true
    });
    mCal.setYearsRange(2000, 2500);
    mCal.setSensitive('2008.10.20,09.30,2008.09.21,2008.09.22');
    mCal.draw();
}
function setDates() {
    mCal.setSensitive([document.getElementById('datesArea').value]);
    mCal.draw();
}
</script> <form action=""> <table cellpadding="10"> <tr> <td valign="top"><div id="dhtmlxCalendar"></div></td> <td valign="top"> <textarea id="datesArea" style="width:330px; height:100px;">2008.10.20,09.30,2008.09.21,2008.09.22</textarea> <br /> <input type="button" value="Set dates" onclick=setDates();> </td> </tr> </table> </form> <br>