本文介绍了我如何验证日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 仅限今天的日期或未来日期 函数BirthDateValidation(dt){ var dtToday = new Date(); var pastDate = new Date(Date.parse(dtToday.getMonth()+/+ dtToday.getDate()+/+ parseInt(dtToday.getFullYear()+ 100))); var lblmesg = document.getElementById(<%= lblMesg.ClientID%>); if(dt< = pastDate){ lblmesg.style.color =red; lblmesg.innerHTML =无效的出生日期; } else { lblmesg.style.color =green; lblmesg.innerHTML =有效出生日期; } } //这是错的吗? 当我输入11/11/1111时,它是显示有效,我该如何修改?Only today's date or future datefunction BirthDateValidation(dt) {var dtToday = new Date();var pastDate = new Date(Date.parse(dtToday.getMonth() + "/" + dtToday.getDate() + "/" + parseInt(dtToday.getFullYear() + 100)));var lblmesg = document.getElementById("<%=lblMesg.ClientID%>");if (dt <= pastDate) {lblmesg.style.color = "red";lblmesg.innerHTML = "Invalid BirthDate";}else {lblmesg.style.color = "green";lblmesg.innerHTML = "Valid BirthDate";}}// is this wrong?when I type 11/11/1111 ,it is display a valid, how do I modify this?推荐答案 这篇关于我如何验证日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 21:38