<html> <head> <title>switch流程控制</title> </head> <body> <script language="javascript"> <!-- /* 1:春季 2:夏季 3:秋季 4:冬季 */ season = prompt("请输入季节编号:(1~4):"); switch(season){ case "1" : msg = "您选取的季节为 春季";break; case "2" : msg = "您选取的季节为 夏季";break; case "3" : msg = "您选取的季节为 秋季";break; case "4" : msg = "您选取的季节为 冬季";break; default : msg = "您输入的季节编号不正确!";break; } document.write(msg); //--> </script> </body> </html>