Copy codeThe Code is as follows:
<! -- Forms [] -->
<Td>
<Div id = "td12Div" style = "display: none;"> Start Date: </div>
</Td>
<Td>
<Div id = "sdateDiv">
<Date: date styleClass = "psm-ui-text" name = "startDate" property = "startDate" divname = "dayScope2"
SourceFormat = "yyyy-MM-dd" targetFormat = "yyyy-MM-dd" readonly = "true"/>
</Div>
</Td>
<! -- Js part -->
Var startDate = document. forms [0]. startDate. value;
Var endDate = document. forms [0]. endDate. value;
If (DateDiff (endDate, startDate)> 3 ){
Alert ("the day range should not exceed three days ");
Return;
}
Function DateDiff (endDate, startDate)
{
Var arrDate, objDate1, objDate2, intDays;
ArrDate = endDate. split ("-");
ObjDate1 = new Date (arrDate [1] + '-' + arrDate [2] + '-' + arrDate [0]);
ArrDate = startDate. split ("-");
ObjDate2 = new Date (arrDate [1] + '-' + arrDate [2] + '-' + arrDate [0]);
IntDays = parseInt (Math. abs (objDate1-objDate2)/1000/60/60/24 );
Return intDays;
}