代码如下: var controldate; function checkDate(){ controldate= document.getElementById(“sendDate”).value; if(controldate==””){ alert(‘日期不能为空’); return false; }else{ var day = new Date(); var Year = 0; var Month = 0; var Day = 0; var CurrentDate = “”; //初始化时间 Year = day.getFullYear(); Month = day.