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

Lab Assignment ‘n Activity                        Computational Thinking



                   1.  Predict the output of the following code:

                       <HTML>
                       <BODY>
                       <H1> JavaScript </H1>
                       <script type="text/javascript">
                       var a=prompt("Enter a number")
                       alert("The Square is “+a*a)
                       </SCRIPT>
                       </BODY>
                       </HTML>
                   2.  Predict the output of the following code:
                       <HTML>
                       <BODY>
                       <H1> JavaScript </H1>
                       <script type="text/javascript">
                       var C=prompt("Enter temperature in Celcius")
                       alert("The Temperature in Fahrenheit is "+((C*9/5)+32))
                       </SCRIPT>
                       </BODY>
                       </HTML>
                   3.  Predict the output of the following code:
                       <HTML>
                       <BODY>
                       <H1> JavaScript </H1>
                       <script type="text/javascript">
                       var text;
                       var a = confirm("Do you know about Metaverse?");
                       if (a == null || a == "")
                       {
                           text = "Prompt cancelled by user";
                       }
                       else
                       {
                         text  =  "The  metaverse  is  a  fictional  iteration  of  the  Internet  as  a  single,
                       universal, and immersive virtual world assisted by the usage of virtual reality
                       and augmented reality headsets.";
                       }
                         document.write(text);
                       </SCRIPT>
                       </BODY>
                       </HTML>


                   4.16 DECISION MAKING

                 Decision making in JavaScript is done by called conditional statements which decide the flow of program execution.
                 The following conditional statements are available in JavaScript:
                 Ð Ðif statement

                 Ð Ðif...else statement
                                                                      Introduction to Dynamic Websites Using JavaScript  311
   308   309   310   311   312   313   314   315   316   317   318