34.1 switch练习1

<!DOCTYPE html>
<html>
     <head>
         <meta charset=”UTF-8″>
         <title>switch练习1</title>
         <script type=”text/javascript”>
             /*
              * 对于成绩大于60分的,输出’合格’。低于60分的,输出’不合格’
              */
             var score=prompt(“请输入成绩:”);
             score=parseInt(score/10);
            
             switch (score){
                 case 6:
                 case 7:
                 case 8:
                 case 9:
                 case 10:
                     alert(“合格”);
                     break;
                    
                    
                 case 0:
                 case 1:
                 case 2:
                 case 3:
                 case 4:
                 case 5:
                     alert(“不合格”);
                     break;
                    
                    
                 default:
                     alert(“请注意:非法输入”);
                     break;
             }
         </script>
     <body>
     </body>
</html>

打赏

发布者

张 大鹏

北京理想国惠玩科技有限公司CEO

发表评论

电子邮件地址不会被公开。 必填项已用*标注