by DNB
27. July 2008 01:30
Here is a Javascript function that validates two dates and indicates if they form a valid date range.
function isValidDateRange( objstartMonth, objstartDay, objstartYear, objendMonth, objendDay, objendYear)
{
var startDate = new Date(objstartYear.options[objstartYear.selectedIndex].value,objstartMonth.options[objstartMonth.selectedIndex].value,objstartDay.options[objstartDay.selectedIndex].value);
var endDate = new Date(objendYear.options[objendYear.selectedIndex].value,objendMonth.options[objendMonth.selectedIndex].value,objendDay.options[objendDay.selectedIndex].value);
if (startDate>=endDate)
{
alert("Invaild Date Range");
return false;
}
else
{
return true;
}
}