Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 52 - 2611_SmartGPT Pro V(5.0) C-8
P. 52

    SOME MORE PROGRAMS

                      Program 1. To print your name using JavaScript

                      <HTML>
                      <HEAD>
                      <TITLE> Print Your Name </TITLE>
                      </HEAD>
                      <BODY>
                      <SCRIPT TYPE="text/javascript">
                      var a=prompt("Enter Your Name");
                      document.write("Your name is ");
                      document.write(a);
                      </SCRIPT>
                      </BODY>
                      </HTML>

                      Program 2. To calculate the multiplication of two numbers using JavaScript

                      <HTML>
                      <HEAD>
                      <TITLE> Multiplication </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("The multiplication is: ");
                      document.write(c);
                      </SCRIPT>

                      </BODY>
                      </HTML>

                       50   Computer Science (V5.0)-VIII

| 47 48 49 50 51 52 53 54 55 56 57 |