onChange / onArrowClick events

Change month/year in selector and click left-right arrows
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>onChange / onArrowClick events</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		#calendarHere {
			position: relative;
			height: 350px;
		}
		#logsHere {
			width: 700px;
			height: 150px;
			overflow: auto;
			border: 1px solid #dfdfdf;
			font-family: Roboto, Arial, Helvetica;
			font-size: 14px;
			color: #404040;
		}
	</style>
	<script>
		var myCalendar;
		var logObj;
		var logInd = 0;
		var logData = [];

		function doOnLoad() {

			myCalendar = new dhtmlXCalendarObject("calendarHere");
			myCalendar.hideTime();
			myCalendar.show();

			myCalendar.attachEvent("onChange", function(d){
				logData.push((++logInd)+") onChange event, "+myCalendar.getFormatedDate("%F %Y",d));
				writeLog();
			});
			myCalendar.attachEvent("onArrowClick", function(d_old,d_new){
				logData.push((++logInd)+") onArrowClick event, "+myCalendar.getFormatedDate("%F %Y",d_new));
				writeLog();
			});
		}


		function writeLog() {
			if (!logObj) logObj = document.getElementById("logsHere");
			var t = "";
			for (var q=logData.length-1; q>=Math.max(logData.length-6,0); q--) t += logData[q]+"<br>";
			logObj.innerHTML = t;
		}

	</script>
</head>
<body onload="doOnLoad();">
	<div style="margin-bottom: 20px;">Change month/year in selector and click left-right arrows</div>
	<div id="calendarHere"></div>
	<div id="logsHere"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.