<link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxcalendar.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxcalendar.js"></script>
<script src="../../codebase/ext/dhtmlxcalendar_double.js"></script>
<style>
#logsHere {
width: 500px;
height: 150px;
overflow: auto;
border: 1px solid #cecece;
font-family: Tahoma;
font-size: 12px;
}
</style>
<script>var myCalendar;
function doOnLoad() {
myCalendar = new dhtmlXDoubleCalendar("calendarHere");
myCalendar.setDateFormat("%Y-%m-%d");
myCalendar.setDates("2012-08-07", "2012-08-17");
myCalendar.show();
myCalendar.attachEvent("onClick", function(side, d) {
writeLog("onClick event called, " + side + " calendar, date " + myCalendar.getFormatedDate(null, d));
});
myCalendar.attachEvent("onBeforeChange", function(side, d) {
var allow = d.getDate() < 20;
writeLog("onBeforeChange event called, " + side + " calendar, date " + myCalendar.getFormatedDate(null, d) + ", " + (allow ? "allow to change": "not allow"));
return allow;
});
writeLog("for tests onBeforeChange will not acceps to change date if day >= 20");
}
var logObj,
logInd = 0;
function writeLog(t) {
if (!logObj)
logObj = document.getElementById("logsHere");
logObj.innerHTML = (++logInd) + ") " + t + "<br>" + logObj.innerHTML;
}
</script>
<div id="calendarHere" style="position:relative;height:250px;"></div>
<div id="logsHere"></div>