我在javascript中的日期验证有问题
问题是我有弹出日历返回一个日期值我想在将其发送到父页面之前检查 javascript 中的日期
在弹出的 calendar.aspx 中
function passDateValue(DateValue)
{
window.returnValue=DateValue;
window.close();
return false;
}
在弹出日历代码隐藏中
ClientScript.RegisterStartupScript(GetType(), "SelectDate", "passDateValue('" + clrPopUp.SelectedDate.ToShortDateString() + "')", true);
调用弹出日历并检查返回值的函数
function Calendar_popup(tbClientID)
{
var today = new Date();
var Day = today.getDate();
var Month = today.getMonth()+1;
var Year = today.getFullYear();
if(Month<10){Month = '0'+Month;}
if(Day<10){Day = '0'+Day;}
var todayFormat = Day + "/" + Month + "/" + Year;
datevalue = window.showModalDialog("Calendar_Dialog.aspx?ctlid=" + tbClientID, '',"dialogHeight:250px;dialogWidth:300px;");
var startdate = Date.parse(datevalue);
var enddate = Date.parse(todayFormat);
if (startdate>enddate)
{alert('BirthDate Must be less than today');
return;
}
}
反正有检查日期吗?
谢谢!