<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <script> var num=prompt("输入0-100的分数"); switch (true){ case num<60: document.write("不合格"); break; case num<70: document.write("一般"); break; case num<90: document.write("良好"); break; case num<100: document.write("优秀"); break; default:document.write("输入正确的分数") } </script> </body> </html>
switch语句的使用
最新推荐文章于 2025-06-21 22:41:41 发布