Page 66 - Chinmaya_C8_flipbook
P. 66

<HTML>
                  <HEAD>

                  <TITLE> Statements in JavaScript </TITLE>
                  </HEAD>
                  <BODY>
                  <SCRIPT type="text/javascript">
                  var a = parseInt(prompt("Enter first number: "));
                  var b = parseInt(prompt("Enter second number: "));

                  var c;
                  c = a + b;
                  document.write("Sum of a and b is: ");
                  document.write(c);
                  </SCRIPT>

                  </BODY>
                  </HTML>
                  Save the file with .html extension and open the web page in web browser. You will get the following
                  output:





























                              SOME MORE PROGRAMS


                  Program 1. To print your name using JavaScript

















                   64   Premium Edition-VIII
   61   62   63   64   65   66   67   68   69   70   71