DHTMLX Docs & Samples Explorer

Attach to custom icon

 
Source
<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/dhtmlxcalendar.js"></script>
    <style>
        #date_here {
            font-family: Tahoma;
            font-size: 12px;
        }
        #calendar_icon {
            vertical-align: middle;
            cursor: pointer;
        }
    </style>
    <script>
var myCalendar;
function doOnLoad() {
    myCalendar = new dhtmlXCalendarObject({
        button: "calendar_icon"
    });
    myCalendar.attachEvent("onClick", function() {
        document.getElementById("date_here").innerHTML = myCalendar.getFormatedDate();
    });
}
</script> <div style="position:relative;height:280px;"> <span><img id="calendar_icon" src="../common/calendar.gif" border="0"></span> <span id="date_here">&nbsp;</span> </div>