function Datevalidate(txtFromdate,txtToDate)
{
var txtFromdate = document.getElementById(txtFromdate);
var txtToDate = document.getElementById(txtToDate);
if(txtFromdate.value!="" || txtToDate.value!="")
{
var str1 = txtFromdate.value;
var str2 = txtToDate.value;
var dt1 = parseInt(str1.substring(0,2),10);
var mon1 = parseInt(str1.substring(3,5),10);
var yr1 = parseInt(str1.substring(6,10),10);
var dt2 = parseInt(str2.substring(0,2),10);
var mon2 = parseInt(str2.substring(3,5),10);
var yr2 = parseInt(str2.substring(6,10),10);
var date1 = new Date(yr1, mon1, dt1);
var date2 = new Date(yr2, mon2, dt2);
if(date2 < date1)
{
alert("To Date cannot be lesser than From Date");
return false;
}
}
}
{
var txtFromdate = document.getElementById(txtFromdate);
var txtToDate = document.getElementById(txtToDate);
if(txtFromdate.value!="" || txtToDate.value!="")
{
var str1 = txtFromdate.value;
var str2 = txtToDate.value;
var dt1 = parseInt(str1.substring(0,2),10);
var mon1 = parseInt(str1.substring(3,5),10);
var yr1 = parseInt(str1.substring(6,10),10);
var dt2 = parseInt(str2.substring(0,2),10);
var mon2 = parseInt(str2.substring(3,5),10);
var yr2 = parseInt(str2.substring(6,10),10);
var date1 = new Date(yr1, mon1, dt1);
var date2 = new Date(yr2, mon2, dt2);
if(date2 < date1)
{
alert("To Date cannot be lesser than From Date");
return false;
}
}
}
0 comments:
Post a Comment