<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<script>
var year =prompt("请输入一个年份")
if(year!=null)
{
var a=isNaN(year)
if(a==false)
{
if(year%1==0&&year>0&&year<9999)
{
var month=prompt("请输入月份")
if(month!=null)
{
var b=isNaN(month)
if(b==false)
{
if(month%1==0&&month>0&&month<=12)
{
var day=prompt("请输入天数")
if(day!=null)
{
var c=isNaN(day)
if(c==false)
{
if(day%1==0&&day>0&&day<=31)
{
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)
{
alert(year+"-"+month+"-"+day)
}
else(month==2)
{
if(year%4==0&&year%100!=0||year%400==0)
{
if(day>0&&day<=29)
{
alert(year+"-"+month+"-"+day)
}
else
{
alert("输入有误")
} }
else
{
if(day>0&&day<=28)
{
alert(year+"-"+month+"-"+day)
}
else
{
alert("输入有误")
}
}
}
}
else
{
alert("输入有误")
}
}
else
{
alert("输入有误")
}
}
}
else
{
alert("输入有误")
}
}
else
{
alert("输入有误")
}
}
}
else
{
alert("输入有误")
}
}
else
{
alert("输入有误")
}
}
</script>