Page 426 - Webapplication11_C11_Flipbook
P. 426

case 1:
                           document.write("You selected Hindi");
                           break;
                        case 2:
                           document.write("You selected English");
                           break;
                        default:
                           document.write("You selected wrong subject");
                     }
                   </script>
                   </body>
                   </html>
                   On running the above program, we get the following output:







































                25.  To check whether a student’s performance is good, better or best.

               Ans.  <!DOCTYPE html>
                     <html>
                     <head>
                         <title> Switch Statement2 </title>
                     </head>
                     <body>
                     <script>
                       var choice = parseInt(prompt("Enter 1 for Good / 2 for better / 3 for
                     best"));
                       switch(choice)
                       {

                424   Touchpad Web Applications-XI
   421   422   423   424   425   426   427   428   429   430   431