Page 381 - Web Applications (803) Class 11
P. 381

}
                        else
                        {
                               document.write(“Try again..............”);
                        }
                      </script>
                      </body>
                      </html>
                      On running the above program, we get the following output:















































                   24.  Write the program to select the subject by user using switch statement

                  Ans.  <!DOCTYPE html>
                      <html>
                      <head>
                          <title> Switch Statement </title>
                      </head>
                      <body>
                      <script>
                        var choice = parseInt(prompt(“Please select the Subject: Enter 1 for Hindi
                      / 2 for English”));
                        switch(choice)
                        {

                                                                                                     Practical Work  379
   376   377   378   379   380   381   382   383   384   385   386