function CompareDateFrom(ptr1,ptr2)
{
if(ptr2.value != ”)
{
d1 = new Date(ptr1.value);
d2 = new Date(ptr2.value);
if(d1 > d2)
{
msg = “From cannot be greater than To!”;
if(msg)
{
alert(msg);
ptr1.value = “”;
return false;
}
}
}
}

<input type=”text” name=”date_from” size=”7″ onblur=”javascript:check_date(this);CompareDateFrom (this,document.formname.date_to);”…….>

<input type=”text” name=”date_to” size=”7″….>