<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> 123 </body> </html> <script> var year = prompt("year","year"); if(year!=null ) { if(year>=1 && year<=9999 && !isNaN(year) && year%1 ==0) { var month = prompt("month","month"); if(month!=null ) { if(month>0 && month<13 && !isNaN(month) && month%1 ==0) { var day = prompt("day","day"); if(day != null) { if(day<=31 && day>=1 && !isNaN(day) && day%1 ==0) { if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) { alert(year+"年"+month+"月"+day+"日"); } else if(month==4||month==6||month==9||month==11) { if(day<=30) { alert(year+"年"+month+"月"+day+"日"); } else { alert("error1"); } } else /*一定是2月*/ { if(day<=28) { alert(year+"年"+month+"月"+day+"日"); } else { if(day==29) { if(year%4==0&&year%100!=0||year%400==0) { alert(year+"年"+month+"月"+day+"日"); } else { alert("error2"); } } else { alert("error3"); } } } } else { alert("error4"); } } } else { alert("error5") } } } else { alert("error6") } } </script>