| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <!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>
- var month = prompt("请输入月份");
- console.log(month);
- switch(month) {
- case "1":
- case "3":
- case "5":
- case "7":
- case "8":
- case "10":
- case "12":
- alert("当前是" + month + "月,该月有31天");
- break;
- case "2":
- alert("当前是" + month + "月,该月有28天");
- break;
- case "4":
- case "6":
- case "9":
- case "11":
- alert("当前是" + month + "月,该月有30天");
- break;
- default:
- alert("当前输入有误 请重新输入");
- break;
- }
- </script>
- </body>
- </html>
|