Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Saturday, August 14, 2010

Javascript date validation

function DateValid()
{
var sDate = document.getElementById('').value;
var eDate = document.getElementById('').value;
var endDate = new Date(eDate );
var startDate= new Date(sDate );
if(sDate != '' && eDate != '' && startDate > endDate )
{
alert("Start date should be greater than End Date.");
return false;
}
if(sDate == eDate )
{
alert("Start date should be greater than End Date.");
return false;
}
}

Thanks & Regards
Santosh Singh

No comments:

Post a Comment