Hi,
I attached the calendar to an input box. Now when people click in the calendar, I want it to show todays date + one month. This is the code I use:
<div style="position:relative;height:250px;">
<input type="text" id="datTerug" value="" />
</div>
<script type="text/javascript">
dhtmlXCalendarObject.prototype.langData["nl"] = {
dateFormat: "%d/%m/%Y",
monthesFNames: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"],
monthesSNames: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
daysFNames: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
daysSNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"],
weekstart: 1
}
var now = new Date();
var mnd;
var datum;
if (now.getMonth() == 11){//11=december
mnd = "/01/";
datum = (now.getYear() + 1) + mnd + now.getDate();
}
else{
mnd = now.getMonth() + 2; //current month: +1, next month: +2
if (mnd<10){
mnd="0"+mnd;
}
datum = now.getYear() + "-" + mnd + "-" + now.getDate();
}
var myCalendar;
myCalendar = new dhtmlXCalendarObject(["datTerug"]);
myCalendar.hideTime();
myCalendar.setDate(datum);
myCalendar.loadUserLanguage("nl");
</script>
If I click in the field datTerug, the calendar shows the date of today, but in the code I said that it should take the date of today + 1 month.
Any suggestions?