11.小例子.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. // alert("内容")//警告框
  11. // prompt("请输入")//提示框
  12. // confirm("好的") //确认框
  13. // window.prompt("请输入年级",18)
  14. // prompt("提示信息",默认输入框中的值)
  15. var month = prompt("请输入月份");
  16. var a = 3; //number
  17. var b = '3'; //string
  18. console.log(month,'mouth')
  19. console.log(a,'a')
  20. console.log(b,'b')
  21. switch(month) {
  22. case "1":
  23. case "3":
  24. case "5":
  25. case "7":
  26. case "8":
  27. case "10":
  28. case "12":
  29. alert("当前是31天");
  30. break;
  31. case "4":
  32. case "6":
  33. case "9":
  34. case "11":
  35. alert("当前是30天");
  36. break;
  37. case "2":
  38. alert("当前是2月");
  39. break;
  40. default:
  41. alert("输入内容不是数字");
  42. break;
  43. }
  44. </script>
  45. </body>
  46. </html>