<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h2>输出指定月份的天数</h2>
<script>
var y=prompt("请输入年份");
var m=prompt("请输入月份");
switch (Number(m)){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:{
document.write(y+"年"+m+"月份有31天"+"<br />");
break;
}
case 4:
case 6:
case 9:
case 11:
{
document.write(y+"年"+m+"月份有30天"+"<br />");
break;
}
case 2:
if(y&4===0 && y%100!=0 || y%400===0){
document.write(y+"年"+m+"月份有29天"+"<br />");
}else{
document.write(y+"年"+m+"月份有28天"+"<br />");
}
}
</script>
</body>
</html>