<script type="text/javascript">
document.writeln(' 输入年份、月份,显示当月的天数'+'<br>')
var year= parseInt(prompt('请输入一个年份'))
var month= parseInt(prompt('请输入一个月份'))
document.writeln('您输入了'+year+'年'+'<br>')
document.writeln('您输入了'+month+'月'+'<br>')
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
document.writeln('您输入的'+month+'月'+'有31天')
break
case 4:
case 6:
case 9:
case 11:
document.writeln('您输入的'+month+'月'+'有30天')
break
case 2:
if(year%4===0&&year%100!==0||year%400===0)
{
document.writeln('您输入的'+month+'月'+'有29天')
}else
{
document.writeln('您输入的'+month+'月'+'有28天')
}
// (years%4===0&&years%100!==0||years%400===0)?
// document.writeln('本月有29天'):
// document.writeln('本月有28天')
break
ddefault :
document.writeln('亲,您的输入不正确'+'您输入的是'+month+'月')
break
}
</script>