JS 输入年份,再输入月份,弹出这个月有多少天?
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> </body> </html> <script type="text/javascript"> var nian = Number(prompt("请输入年份")); var yue = Number(prompt("请输入月份")); if(yue ==1 ||yue ==3 ||yue ==5 ||yue ==7 ||yue ==9||yue ==11 ) { alert("31天"); } else if(yue ==2) { if ( (nian % 4 == 0) && (nianfen % 100 != 0)) { alert(nian+"瑞年"+"29天"); } else if(!(nian % 400 == 0)) { alert(nian+"瑞年"+"29天"); } else { alert(nian+"平年"+"28天"); } } else{ alert("30天"); } </script>