12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
-
- <!--
- 需求:
- 进入页面,输入月份,判断是几月并弹出该月的实际天数
- -->
- <script>
- // alert("你好")
- var month = prompt("请输入月份");
- console.log(month,'月份',332)
- switch(month) {
- case "1":
- case "3":
- case "5":
- case "7":
- case "8":
- case "10":
- case "12":
- alert("当前是"+month+"月,天数是31天");
- break;
- case "4":
- case "6":
- case "9":
- case "11":
- alert("当前是"+month+"月,天数是30天");
- break;
- case "2":
- alert("当前是"+month+"月,天数是28天");
- break;
- default:
- alert("输入月份不正确");
- break;
- }
- </script>
- </body>
- </html>
|