function ckBirthday(){ var thetime=tool.getEditerByName("<%=dwName%>","Birthday"); var time=thetime.value;//输入的时间1992-03-09 //字符串1993-03-09日期转为日期格式 var regEx = new RegExp("\-","gi"); time=time.replace(regEx,"/"); var d=new Date(Date.parse(time)); //var inputYear=time.substr(0,4);//输入年 //var inputMon=time.substr(5,2);//月 //var inputDay=time.substr(8,2);//日 var inputDate=time.replace(/-/g,"");//替换成19920309 var curDate=new Date();//当前日期 if(d >curDate){ tool.alert("请选择小于今天的时间!"); } var curYear=curDate.getFullYear(); var curMon=(curDate.getMonth()+1); curMon=curMon<10?'0'+curMon:curMon; var curDay=curDate.getDate(); curDay=curDay<10?'0'+curDay:curDay; var curDateStr=curYear+curMon+curDay; var dd=parseInt(curDateStr)-parseInt(inputDate); if(dd>=180000&&dd<690000){//判断是否18~68周岁 return true; }else{ tool.alert("年龄应18~68周岁之间"); return false; } }