Hi IP,
Try this code on the 'onClick' event of calendar control, this works for me every time.
function calendar1_onclick(ctrl)
{
var NewToday = new Date();
var Today = new Date(NewToday.getFullYear(), NewToday.getMonth(), NewToday.getDate());
var DateMM = Today.getMonth() + 1;
// javascript months are 0 through 11
var DateDD = Today.getDate();
var DateYYYY = Today.getFullYear();
var DatePrevYY = DateYYYY - 1;
< !-- need 2-digit months and days and 4-digit years -->
if (DateMM < 10) DateMM = '0' + DateMM;
if (DateDD < 10) DateDD = '0' + DateDD;
document.getElementById('calendar1').value = '05' + '/01/' + DatePrevYY;
}
function calendar2_onclick(ctrl)
{
var NewToday = new Date();
var Today = new Date(NewToday.getFullYear(), NewToday.getMonth(), NewToday.getDate());
var DateMM = Today.getMonth() + 1;
// javascript months are 0 through 11
var DateDD = Today.getDate();
var DateYYYY = Today.getFullYear();
< !-- need 2-digit months and days and 4-digit years -->
if (DateMM < 10) DateMM = '0' + DateMM;
if (DateDD < 10) DateDD = '0' + DateDD;
document.getElementById('calendar2').value = DateMM +'/'+ DateDD +'/'+ DateYYYY;
}
WebFOCUS release 7.7.03, HTML, PDF, Excel